iOS 5 : -viewWillAppear is not called after dismissing the modal in iPad

后端 未结 3 2131
借酒劲吻你
借酒劲吻你 2020-12-15 04:28

I am presenting modal using the following code :

AddName *add = [[AddName alloc] initWithNibName:@\"AddName\" bundle:nil]
add.modalPresentationStyle = UIMod         


        
3条回答
  •  攒了一身酷
    2020-12-15 04:56

    iOS 5 definitely changed their calls to viewWillAppear and viewWillDisappear. For instance, subviews (View Controller's views as subviews to be exact) in a UIScrollView, viewWillDisappear will get called when you push another view controller onto the stack. However, when the view controller is popped, viewWillAppear does not get called. These methods were never called in iOS 4 on UIScrollView subviews.

    This is strange behavior to me. Couple that with the fact that regardless of what should happen, if you could rely on it happening in iOS 4, it should not be working differently in iOS 5. Most of the time, I have no idea in which particular instance each one is called, I usually trial and error it as I'm in the zone coding. If it works the way I like, I move on. Then iOS 5 comes in and throws a wrecking ball into everything.

    I have also experienced when a UINavigationController's view is a subview, and a ViewController is pushed on the navigation controller stack, viewWillAppear never gets called in iOS 4, but does get called in iOS 5. Go figure.

提交回复
热议问题