ios - UITabBarController added programmatically, but tab bar doesn't display -
i did not start uiwindow uiview add uitabbarcontroller.
i have array of file names in documentfilename , hope load them 1 one in subviews, each in 1 tab.
viewcontrollers = [[nsmutablearray alloc] init]; (nsstring *tempstr in documentfilename) { subview *subviewcontroller = [[subview alloc] initwithfilename:tempstr]; [viewcontrollers addobject:subviewcontroller]; } tabbarcontroller.viewcontrollers = viewcontrollers; [self.view addsubview:tabbarcontroller.view]; } in subview.m:
- (id) initwithfilename:(nsstring *)filename { isiphone = [[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone; if (self = [super initwithnibname:((isiphone)?@"nflspromdressingssubview_iphone":@"nflspromdressingssubview_ipad") bundle:nil]) { currentfilename = filename; } return self; } - (void) viewdidload { [self loaddocuments]; uitabbaritem *theitem = [[uitabbaritem alloc] initwithtabbarsystemitem:uitabbarsystemitemfavorites tag:[documentfilename indexofobject:currentfilename]]; self.tabbaritem = theitem; } however, tab bar appears white , empty. did made mistakes? thanks.
make sure tabbar initiated , in viewdidload method add tabbar view [self.view addsubview:tabbarcontroller.view];
Comments
Post a Comment