iphone - Add titles to tabbar created programmatically -
iphone - Add titles to tabbar created programmatically -
i new iphone development... trying build application in creating uitabbarcontroller
programmatically below:
uitabbarcontroller *tabbar = [[uitabbarcontroller alloc] init]; firstviewcontroller *firstview = [[firstviewcontroller alloc] initwithnibname:@"firstviewcontroller" bundle:nil]; uinavigationcontroller *tabitemone = [[[uinavigationcontroller alloc] initwithrootviewcontroller: firstview] autorelease]; secondviewcontroller *secondview = [[secondviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:nil]; uinavigationcontroller *tabitemtwo = [[[uinavigationcontroller alloc] initwithrootviewcontroller: settings] autorelease]; tabbar.viewcontrollers = [nsarray arraywithobjects:tabitemone, tabitemtwo,nil]; tabbar.view.frame = cgrectmake(0,0,320,460); [self.view insertsubview:tabbar.view belowsubview: firstview.view]; [self presentmodalviewcontroller:tabbar animated:no];
in this, how can add together titles tabbar
, controllers. have tried:
firstview.title = @"first view";
and
tabitemone.title = @"first view";
but these 2 don't work.. how accomplish this?
setting aviewcontroller.title sets title both navigationitem , tabbaritem. if want navigationitem , tabbaritem have different title, this,
// first set view controller's title aviewcontroller.title = @"first view tab"; // set navigationitem's title aviewcontroller.navigationitem.title = @"first view";
iphone objective-c ios uitabbarcontroller tabbarcontroller
Comments
Post a Comment