ios - Run UIViewController inside UINavigationController as a second view of UISplitViewController -
i have problem trying access navigation controller of view controller it, returns nill me, though shown within navigation controller. here have (i have split view controller, presented tab controller master , viewcontroller (inside navigation controller) detail):
firstdetailviewcontroller *fdvc = [[firstdetailviewcontroller alloc] initwithnibname:@"firstdetailviewcontroller" bundle:nil]; uinavigationcontroller *fdvcnav = [[uinavigationcontroller alloc] initwithrootviewcontroller:fdvc]; nsarray *ipadvcs = [[nsarray alloc] initwithobjects:tabcontroller, fdvcnav, nil]; uisplitviewcontroller *splitvc = [[uisplitviewcontroller alloc] initwithnibname:nil bundle:nil]; [splitvc setviewcontrollers:ipadvcs]; [[splitvc view] setbackgroundcolor:[uicolor colorwithpatternimage:[uiimage imagenamed:@"splitviewcontrollerbg"]]]; [splitvc setdelegate:fdvc]; [[self window] setrootviewcontroller:splitvc]; [[self window] makekeyandvisible];
but when i'm trying access navigation controller fdvc view controller in viewdidload [self navigationcontroller] gives me (null) always. thanks!
i fixed it. turned out, had move code viewdidload method viewdidappear , worked fine.
viewdidload getting called before navigationcontroller property has been updated, mistake.
Comments
Post a Comment