Dima Deplov
Dima Deplov

Reputation: 3718

iOS UINavigation Controller basics and custom back button

I make my first "serious" iOS app, and have some troubles with the whole UINavigation concept, but all in order. I look answers for my questions but don't find what I want, so here it is.

I want to make menu to a game, it would be look like so:

1) It's a RootViewController and it contain some buttons: new game, options, about.

2) I think it will be another view controller (It must appear when we touch new game button, and we see a menu when we choose game difficulty) the buttons is: easy, medium, hard

3) The game view controller (I think that this VC won't be the part of UINavigationController).

I have some concepts that I want to embody in this menu.

Here is it: I don't want to use UINavigationController Navigation bar, I won't use standard slide animation for UINavCon, I want to make my buttons "move to transparency" and come back with another menu from paragraph 2 mentioned above, it's not necessarily to change background or something else except menu items. I want to use custom back button, and want to add it to the position I want and not to Navigation Bar.

I have some ideas about animation of menu items.

I don't know this:

It is better to use UINavigationController for my purposes or it's better to use normal ViewController?

If I make a UINavigationController can I see it's "child VCs (I mean not a root VC)" in my storyboard or it will be programmatically created thing and I must make it UI in code? If i must do this programmatically, could I make a segue from UINavigationController from storyboard, or I must do this from code too?

Could I make a UIButton, for example, and assign it functions from a normal UINavigationController back button from Navigation Bar?

Some questions might be dumb, but hope you won't judge me hard.

Upvotes: 0

Views: 343

Answers (1)

charleyh
charleyh

Reputation: 2063

Okay, I'll do my best: For custom animations, see

Yes, you make a custom segue class with the animation. try: joris.kluivers.nl/blog/2013/01/15/… and developer.apple.com/library/ios/#featuredarticles/… and cmumobileapps.com/2011/11/04/a-short-tutorial-on-custom-segues

Yes, i think a view controller is your best bet. But by the way, even if you use a navigation controller, you still use normal view controllers. A UINavigationController holds different UIViews, which go forward and backward on the navigation stack. Also, you will need to look up what you need to do to hide the navigation controller.

You can see the child view controllers in a storyboard if you create them their, but not if they are created programmatically, unless you just have the view in their. [self.navigationController popViewControllerAnimated:YES] will "press the back button" programmatically, so just link the custom back button to a method that calls this.

If that doesn't cover all of your questions, just comment and I'll answer any more :)

Upvotes: 1

Related Questions