iphone - My viewcontroller (in the navcontroller) I load in my app delegate overlaps the tabbar -


i'm having trouble initializing viewcontroller when app loads in app delegate. viewcontroller loads okay, overlaps tabbar have @ bottom. need create viewcontroller , have load in app delegate? have tabbarcontroller set in mainwindow.xib, contains navigation controllers , inside viewcontrollers.

here code...

in didfinishlaunchingwithoptions have:

sub = [[subgabviewcontroller alloc] initwithnibname:@"subgabviewcontroller" bundle:nil]; nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:sub]; [window addsubview:nav.view]; 

should like?

sub = [[subgabviewcontroller alloc] initwithnibname:@"subgabviewcontroller" bundle:nil]; nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:sub]; [newviewcontroller.view addsubview:nav.view]; 

thanks!

if you're trying use uitabbarcontroller, each tab has own root view controller (these can uinavigationcontroller objects). assuming have property self.tabbarcontroller (i think gets created default in xcode if doing tab-bar app), then:

sub = [[subgabviewcontroller alloc] initwithnibname:@"subgabviewcontrller" bundle:nil]; nav = [[uinavigationcontoller alloc] initwithrootviewcontroller:sub]; [self.tabbarcontroller setviewcontrollers:[nsarray arraywithobject:nav] animated:no]; self.window.rootviewcontroller = self.tabbarcontroller; // clean memory here... if don't need references them [sub release]; [nav release]; 

with setviewcontrollers:animated: should include additional view controllers in nsarray, otherwise you'll end tab bar containing 1 item!


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -