loading and unloading uiviewcontrollers
i don't really know how to handle a special case.
i know how to handle with view controllers when i'm using tabbars, or navigation controllers or something like this.
but now i want to build a game. and... games often don't have navigationcontrollers or tabbars, also mine doesn't have something like this.
so in my first view, i have u button, pushing this, initiates a new viewcontroller and adds his view as a s开发者_开发技巧ubview on top of the fist view controller. ending this viewcontroller , i remove the new viewcontroller from superview.
but the viewcontroller is still initiated and in my memory.
do you have any tips for handling view controllers the way i want? diplay view controller 1 -> click -> display view controller 2, unload 1 -> click -> display view controller 1 , unload 2
don't know if i'm right with the way i want. thanks for any tips about handling view controllers "game like"
Could you not use:
-[UIViewController presentModalViewController:animated:]
to accomplish this? A lot less to maintain and you don't have to worry about the mechanics of memory management either (other than implementing init
, dealloc
, viewDidLoad
, viewDidUnload
).
精彩评论