2011-10-11 76 views

回答

1

首先,你必須把它放置在WWW文件夾後,引用NativeControls.js文件中的HTML頁面。確保該文件位於html的phonegap.js文件之後。接下來,將.m & .h文件添加到plugins文件夾中。最後,將NativeControls添加爲phonegap.plist文件中的一個鍵,並將值設置爲字符串。另外請記住,這個插件只適用於iPhone。

你也可以嘗試檢查出http://hiediutley.com/2011/03/30/phonegap-tutorial-series-%E2%80%93-5-third-party-plugins-nativecontrols/

+0

我所做的一切如上,但我仍然沒有得到標籤欄。你能提供一些幫助嗎? – c0d3Junk13

+0

在這裏發佈一個問題:http://stackoverflow.com/questions/10035821/phonegap-nativecontrols-not-working與我的代碼。 – c0d3Junk13

0

包括在WWW文件夾NativeControls.jsNativeControls.hNativeControls.m文件Plugins文件夾中的項目。在Cordova plist文件中,將名爲'Plugins'的項下的鍵值對添加爲'NativeControls'(鍵名和值:NativeControls)。

如果您正在使用本地控件的標籤欄,放置在onDeviceReady function如下:

nativeControls = window.plugins.nativeControls; 
nativeControls.createTabBar(); 

// First tab 
nativeControls.createTabBarItem(
    "tab1", 
    "Tab1", //Name that appears on tab item 
    "....png", //Tab image placed in Resources folder 
    { "onSelect": function() {}} 
); 

// Second tab 
nativeControls.createTabBarItem(
    "tab2", 
    "Tab2", 
    "....png", //Tab image placed in Resources folder 
    { "onSelect": function() {}} 
); 

// Third tab 
nativeControls.createTabBarItem(
    "tab3", 
    "Tab3", 
    "....png", //Tab image placed in Resources folder 
    { "onSelect": function() {}} 
); 

// Compile the TabBar 
nativeControls.showTabBar(); 
nativeControls.showTabBarItems("tab1", "tab2", "tab3"); 
nativeControls.selectTabBarItem("books");