Built-in iphone tab bar in phone

I want to use my own iphone tab bar using phonegap. I used the code and plugin shown at http://wiki.phonegap.com/w/page/16494801/iPhone:-UIControls-%28TabBar%29 . But the tab bar did not appear. Can someone help me get the tab bar in my application?

+4
source share
4 answers

This is pretty easy. Usually this will not happen because you add the fourth parameter.

TabBar expects this fourth parameter or null. But the test, if it exists, is buggy.

So just enter the dummy element β†’ {(foo: "bar")} <---

plugins.tabBar.createItem("Advent Calendar", "Sven Elch", "abc.png", { foo : "bar" } // <----- ); 

or correction if the condition is in TabBar.m (line 334 or so).

 if(options != [NSNull null]) { id badgeOpt = [options objectForKey:@"badge"]; if(badgeOpt && badgeOpt != [NSNull null]) item.badgeValue = [badgeOpt stringValue]; } 
+2
source

I believe the plugin is out of date. Go to http://github.com/phonegap/phonegap-plugins/ . There you will see a plugin called native control for iPhone. This is the plugin you want to use.

After you download it, add the nativecontrols files to your plugins folder in your project. Add NativeControls as a key and value to the phonegap.plist file. Add the nativecontrols js file to your www directory. Then you can create, show, etc. Your tab

0
source

Just try the following:

 <script> var moreNum = 1; plugins.nativeControls.createToolBar(); plugins.nativeControls.setToolBarTitle("hello"); plugins.nativeControls.createTabBar(); plugins.nativeControls.createTabBarItem("search","search","tabButton:Search"); plugins.nativeControls.createTabBarItem("book","book","tabButton:Contacts"); plugins.nativeControls.createTabBarItem("more","more","tabButton:More",{"onSelect":function(){ plugins.nativeControls.updateTabBarItem("more",{"badge":((++moreNum).toString())}); }}); plugins.nativeControls.showTabBar(); plugins.nativeControls.showTabBarItems("book","search","more"); </script> 
0
source

Steps (can be the same for any plugin):

  • Get the iOS NativeControls Plugin
  • Copy the * .xib, * .m and * .h files to your Plugins project folder (must already exist and contain the README file)
  • They should also be added to the project, so drag them from the Plugins folder (in Finder) to the same folder (in Xcode) and select to create links
  • Open "Resources / Cordova.plist" and in the "Plugins" section add a key with the plugin name "NativeControls" and the string value "NativeControls" (I assume that this is the name of the main class of the plugin)
  • Try the following example ( NOTE: this example is from 2012-06-28, I am actually working on an improved version that removes the functionality of the toolbar and replaces it with the actual working navigation bar - see here )

     window.plugins.nativeControls.createTabBar() window.plugins.nativeControls.createTabBarItem('home', 'Home', 'tabButton:Contacts') window.plugins.nativeControls.showTabBar() window.plugins.nativeControls.showTabBarItems('home') window.plugins.nativeControls.createToolBar() window.plugins.nativeControls.setToolBarTitle('Hello toolbar!') window.plugins.nativeControls.showToolBar() alert("Tabs and toolbar should now become visible") 

I can’t make the toolbar title work, however, both the tab and the toolbar itself are shown (without text).

0
source

All Articles