iOS view hierarchy and nested navigationcontrollers -


i have 3 viewcontroller/views @ root of application: loginviewcontroller, homeviewcontroller, , playviewcontroller

what i'm looking way swap between these 3 based on state (eg: logging in result in loginviewcontroller pinging delegate [the rootviewcontroller] remove , display homeviewcontroller)

i seem have couple options here:

1.rootviewcontroller uiviewcontroller. adds/removes subviews needed.

[self.view addsubview:loginviewcontroller.view]; 

2.rootviewcontroller uiviewcontroller. presents/removes views modally needed.

[self presentviewcontroller:loginviewcontroller animated:no completion:nil]; 

3.rootviewcontroller uinavigationcontroller. pushes/pops stuff.

[self pushviewcontroller:loginviewcontroller]; 

i have read first option kinda working around whole idea of viewcontroller supposed be, , therefore not ideal.

the second option seems odd because entire application modal? can viewcontrollers modally presented on top of modally presented viewcontrollers?

the third option seems best, (as stated here), runs few problems specific implementation:

  • the metaphor "navigationcontroller" doesn't fit (i'm not "drilling down home controller" logging in...)
  • do switch out navcontroller's rootviewcontroller? or push playvc on top of homevc on top of loginvc?
  • loginvc navigationviewcontroller in itself- pushes on vc's go through multi-step process of creating account, , can't push navcontrollers on navcontrollers.

so, question this:

what best way architect view controllers @ equal level of hierarchy when of them uinavigationcontrollers themselves?

****note:*** have looked here, didn't give sufficent answers use case (multiple navcontrollers).*******


edit: i've found answer: i'm thinking of problem wrong, , should instead thinking in terms of creating own container viewcontroller.

i think should consider combination of 2 , 3. since login 1 time thing in session, best not have controllers alive time -- better use them, , have them go away. this, make root view controller of window navigation controller homeviewcontroller root, push transition playviewcontroller. loginviewcontroller should presented modally, viewdidappear method in homeviewcontroller appear when app first opens (if have animation turned off). it's ok present navigation controller modally, cover root navigation controller, won't see 2 navigation bars.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -