Simple menu on iPhone

I am developing a puzzle for the iPhone using basic graphics that implements drawrect in one UIView.

I would like to add a menu that opens from the UIButton event handler.

I'm not sure if I should do this with code, for example. have a menu flag and configure drawing routines and use event handlers (manual implementation) or go along the UINavigationController route and have a completely separate view that will be activated, I assume in the UINavigationController from the button event.

Currently, my music and sound are related to the class attached to the β€œmain” UIView in my game, and are initialized via ViewDidLoad.

Any advice is appreciated.

+3
source share
1 answer

You must place your menu code in another view object. Do not just redraw the existing view in menu mode. This will make your code unnecessarily complicated.

However, you do not need to use the UINavigationController to replace one view for another. You yourself write the code to remove the game mode ( removeFromSuperview), and add the menu view ( addSubview:) to the application window using a transitional animation if you want.

You can also use the UIViewController method presentModalViewController:to display the look of your menu on top of the game view.

, , , , , , , .

+2

Source: https://habr.com/ru/post/1731254/


All Articles