0

Please help me with the concept I'm new to iOS.

I'm developing an app witch have 2 main stories / views.

When app starts it checks NSUserDefaults, and if is: NSInteger witchView = [prefs integerForKey:@"setView"]; set to 1 I start app using view1.

Then from a view1 I can go to settings and there have an switch button for set witch view will load on stat. This works perfect ... if I set to be view2 to start on startup it works.

View2 also have the settings button and can go to identically settingsView.

What I'm trying to do is when go back from the settings automatically start the different view if that was set in option's view.

Now I have to restart app if I want that.

I have the AppDelegate class witch starts View1 or View2. From View1 and View2 I can go to SettingsView.

Do I have to connect SettingsView with the AppDelegate? And every time when I press settings button always dismiss view1 or view2 and from the AppDelegate start SettingsView and on return again start the appropriate one?

What is the best way to do this?

Thanks, Matej

Matej Zimic
  • 73
  • 1
  • 6

1 Answers1

0

it doesn't really clear if you are using NavigatioController or ModalDialog , any way it seems like both not appropriate for you scenario. since if the user change the setting and he wants to go back you cant promise he will come back to the same viewController. so when you using UINavigationController it means you would like to go the same viewController if someone push the backButton.

i think you should probably use some animation to navigate.

try this:

[UIView transitionWithView:containerView

       duration:0.2

       options:UIViewAnimationOptionTransitionFlipFromLeft

       animations:^{ [fromView removeFromSuperview]; [containerView addSubview:toView]; }

       completion:NULL];
Amir Bareket
  • 431
  • 5
  • 11
  • I use ViewControllers. The problem is probably in my understanding of loading and dismissing views. I have 3 ViewControllers and Nib files. Vhen the app starts firs go in AppDelegate and from here starts one of scenario. View1 or View2. Lets say it starts View1 with ViewController1 and from that View we can go to settings where we set the load view (View1 or View2) and other options too. If we set the different View to load I want that that view is loaded on going back. Not the previous one. Thanks, Matej – Matej Zimic Nov 23 '12 at 22:03
  • in case the user change the setting and then go back , after he goes back you could make some animation to change from view1 to view 2 as i wrote above. but for your case it maybe better using ModalDialg because ios users expect to see the previus screen when they go back. so with modal dialog you will have cancel and save buttons and you could use the save button to switch between the views before you dismiss the modalDialog. – Amir Bareket Nov 25 '12 at 07:48
  • Aha, now I see what you mean. Thank you. I'll try. – Matej Zimic Nov 25 '12 at 20:28