views:

25

answers:

1

hello, I am struggling with my app for a couple of days now and there are some things I am not sure to do correctly. I have an app with a login view controller, a tab bar view controller and a landscape view controller that should only be used when the first tab is in landscape mode. I have added those 3 controllers as attributes of the AppDelegate. Each time I need to switch view I perform stuff like: - remove the current view from the super view - add the new view to the windows with [window addSubview:newViewController.view]

Is this the right way to do this ?

Thanks a lot, Luc

A: 

I don't like the idea of adding those ViewControllers as properties. Though it is fine.

El Developer
I agree, that is not really sexy. How would you do ? Thanks, Luc
Luc
I would probably make a class that holds all of those 3 UIViewControllers and create a method to add each UIViewController to a given View. Or just access the new Class properties (your UIViewControllers) and add those properties to a given view.Depends on how much interaction each view controller has.
El Developer
Hello, I am not sure t fully understand. In fact the reason I am asking this is because I did not know if switching view could be done with a [window addSubView:mycontroller.view] and I wondered if this way of doing this could lead me to some other problems (like the one details in http://stackoverflow.com/questions/3149921/iphone-cannot-switch-back-from-my-landscape-view-to-a-portrait-view) Thanks a lot for your help.
Luc

related questions