objective c - add/hide UITabBarItem -


i have uitabbarcontroller , add tab, ability make disappear. added 2 tabs xcode. can add third tab program? know command like:

  [self setviewcontrollers: [nsarray arraywithobjects: x1, nil] animated: no]; 

you can retrieve array uses xcode add third view? thanks


i can not load view code. created view controller storyboard, when try load code black screen, use code:

viewcontrollera *x1 = [[viewcontrollera alloc] init]; [self setviewcontrollers:[nsarray arraywithobjects: x1, nil] animated:no]; 

yes, if use [uitabviewcontroller setviewcontrollers: animated:] can add in array containing 2 previous view controllers plus new third one.

for example, you'd want this:

// assuming you've set iboutlet tab bar controller nsarray * currentsetofviewcontrollers = [apptabbarcontroller viewcontrollers]; if((currentsetofviewcontrollers == null) || [currentsetofviewcontrollers count] == 0)) {     nslog( @"i don't see view controllers; tab bar controller outlet set properly?") } else {     nsmutablearray newsetofviewcontrollers = [[nsmutablearray alloc] initwitharray: currentsetofviewcontrollers];     if(newsetofviewcontrollers)     {         viewcontrollera *x1 = [[viewcontrollera alloc] init];         if(x1)         {             [newsetofviewcontrollers addobject: x1];              [apptabbarcontroller setviewcontrollers: newsetofviewcontrollers];              // release our alloc'd mutable array if not have arc turned on             [newsetofviewcontrollers release];         }     } } 

you'd want give new view controller associated tab bar item title , image. check out [uitabbaritem initwithtitle: image: tag:].

i've linked apple documentation hope help!


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -