简体   繁体   中英

Assigning a IBAction to the Back Button of the Navigation Bar (iPhone SDK)

In this ( Flip View Iphone ) post, I have created a flip view for my iPhone app. Now, I want to make sure that whenever the user hits the 'Back' button in the navigation bar, the next time around when he drills down to the flippable view, this view is in its original, non-flipped position. Currently, the app actually loads the correct view, but somehow, when you try to flip it over, it cannot doesn't load the flip view, and presents a black background only. One solution could be to assign the flip back method ("showLessInfo") to the navigation button, and that is what I need your help for. Alternatively, and quite likely a better idea for me would be to understand, why the flip view is not loaded the second time around. Any suggestion is welcome!

You can override the viewWillAppear: method on your flip view's view controller and make sure behind the scenes it loads the proper view before showing (remember to call [super viewWillAppear:animated] ).

Or else, you could override the viewWillDisappear and make sure things are cleaned up on the way out. It will get invoked when the user taps the back button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM