ios - View never loads -


- (void)application:(uiapplication *)application performactionforshortcutitem:(uiapplicationshortcutitem *)shortcutitem completionhandler:(void (^)(bool))completionhandler {      mainview *main=[[mainview alloc]initwithnibname:@"mainview" bundle:nil];     // module collect metrics notification received, notification displayed     uinavigationcontroller *navbar=[[uinavigationcontroller alloc] initwithrootviewcontroller:main];      // react shortcut item selections     nslog(@"a shortcut item pressed. %@.", shortcutitem.localizedtitle);     if([(nsstring *)shortcutitem.localizedtitle isequaltostring:@"store"])     {         purchaseview *purchaseviewcontroller = [[purchaseview alloc] initwithnibname:@"purchaseview" bundle:nil];         [navbar pushviewcontroller:purchaseviewcontroller animated:yes];     } } 

i enter if([(nsstring *)shortcutitem.localizedtitle isequaltostring:@"store"]) loop , see code executing. purchaseview.xib never loads. have similar code push notification , works when pushing view load.

any appreciated.

the problem here bad view hierarchy. added xib file's view controller brand new uinavigationcontroller not exists anywhere in view hierarchy. believe want this:

uinavigationcontroller *navbar = (uinavigationcontroller *) self.tabbarcontroller.selectedviewcontroller; [navbar pushviewcontroller:purchaseviewcontroller animated:yes]; 

again, above hypothetical example. need find out right uinavigationcontroller in view hierarchy.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -