iphone - Setting rootViewController for ipad 3.2 doesnt work -


i did simple navigationbased app. works on iphone well, doesnt work on ipad 3.2 simulator , device.

in applicationdidfinish event;

mainviewcontroller *viewcontroller = [[mainviewcontroller alloc] initwithnibname:@"mainview" bundle:nil]; [self.navigationcontroller pushviewcontroller:viewcontroller animated:no]; self.window.rootviewcontroller = self.navigationcontroller; [viewcontroller release]; 

it says line:

self.window.rootviewcontroller = self.navigationcontroller; 

[uiwindow setrootviewcontroller:]: unrecognized selector sent instance 0x4c22dd0

but works on ipad 4.2 , over.

how can solve ipad 3.2?

uiwindow did not have rootviewcontroller property in ios < 4.0. therefore, need check version (google it) , either set rootviewcontroller, or add navigationcontroller's view subview window below, based on version user running.:

[self.window addsubview:self.navigationcontroller.view]; 

quick edit: check if can use rootviewcontroller property, can check if [self.window respondstoselector:@selector(setrootviewcontroller)] returns true or false.


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 -