ipad - adding UITabBarItems to the UITabBar -


i hope can explane me how this:

i have tabbar , 2 tabbaritems, how can attatch items tabbar. not doing via ib because tabbar fits have of screen because items should on left side.

thats how build them:

tabbarcontroller = [[uitabbarcontroller alloc] initwithnibname:nil bundle:nil]; tabbarcontroller2 = [[uitabbarcontroller alloc] initwithnibname:nil bundle:nil];  tabbarcontroller.tabbar.frame = cgrectmake(0, 974, 384, 50);     tabbarcontroller2.tabbar.frame = cgrectmake(384, 974, 384, 50);  uitabbaritem *tbi1 = [[uitabbaritem alloc] initwithtabbarsystemitem:uitabbarsystemitemmostviewed tag:0]; uitabbaritem *tbi2 = [[uitabbaritem alloc] initwithtabbarsystemitem:uitabbarsystemitemmostviewed tag:1]; 

you don't set tab bar items directly in tab bar. instead, assign tab bar item tabbaritem property each view controller contained tab bar controller. when add view controllers tab bar controller, tab bar controller manage display of tab bar items you.

uitabbarcontroller * tabbarcontroller = [[uitabbarcontroller alloc] init];  uiviewcontroller * viewcontroller1 = [[yourviewcontroller alloc] init]; uiviewcontroller * viewcontroller2 = [[yourotherviewcontroller alloc] init];  viewcontroller1.tabbaritem = [[uitabbaritem alloc] initwithtabbarsystemitem:uitabbarsystemitemmostviewed tag:0]; viewcontroller2.tabbaritem = [[uitabbaritem alloc] initwithtabbarsystemitem:uitabbarsystemitemmostviewed tag:1];  tabbarcontroller.viewcontrollers = [nsarray arraywithobjects:viewcontroller1, viewcontroller2, nil]; 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -