Tuesday, 11 February 2014

Override first view shown in tab bar app?


i've got tabbar application using storyboards, automatically shows viewcontroller (firstvc) in first tab.

i'd have login-view appear @ beginning of app instead of first tab, not have separate tab.

obvious solution push login-view firstvc, firstvc not first viewcontroller respond in app - (depending if push notification received) viewcontroller shown first.

best way guess initiate login-view appdelegate, responds first (of course). no matter how initiate here, content of selected tab (for instance firstvc) shown instead.

appdelegate.m
code:
  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions  {        // not show loginvc on top       uitabbarcontroller *tabbarcontroller = (uitabbarcontroller *)self.window.rootviewcontroller;    // have tabbarcontroller, since appdel not represented in storyboard      firstviewcontroller *firstvc = [[tabbarcontroller viewcontrollers] objectatindex:0];            // have firstvc since tabbarcontroller not implement pushviewcontroller      loginviewcontroller *loginvc = [firstvc.storyboard instantiateviewcontrollerwithidentifier:@"login"];      [firstvc.navigationcontroller pushviewcontroller:loginvc animated:yes];  }  
i tried addsubview in appdelegate.m, same thing happened there - login-view not appear on top (if @ all).

tried alternative approach creating new mainviewcontroller should initial view controller in storyboard, , have tabbarcontroller subview of it. did not work @ - not make connection between mainviewcontroller , tabbarcontroller when first set initial view controller (the reverse works fine, of course, adding new tab).

suggestions?
 

what presenting modal view?
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment