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

后端 未结 3 2124
借酒劲吻你
借酒劲吻你 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:47

    -viewWillAppear is only guaranteed to be called in places where the -viewWillDisappear has also been called. For most modal windows on the iPad, this is not the case, since they don't obscure the entire page.

    The solution to your problem will depend on what you need the -viewWillAppear for, but in general, you're likely to need to make a call directly from the same place that you dismiss the modal view controller.

    One common mechanism for this, especially in cases where you might use that same modal view somewhere else, is to give the modal view controller a delegate which is called when the view is about to disappear. This will give you a chance to take the responses from the modal window, or even just force a data reload in the delegate view.

    Hope this helps.

提交回复
热议问题