开发者

Show UIAlertView in viewDidDisappear: buttons not reacting?

In viewDidDisappear: of a modally presented controller I added a callback to inform who ever is interested about the view being gone (after the animation has finished) without requiring subclassing. One of my controllers that registered for the callback is firing up a UIAlertView in there. However, once the alert is shown, its buttons don't开发者_StackOverflow react. Another one is adding a subview to itself and again: the buttons of the view don't react. The resposible handlers of the buttons are not triggered. I assume it has to do with the fact that viewDidDisappear: is not really finished yet when it call my callback. But even if I used subclassing instead, it would be the same situation. One explanation could be that there is still some other view covering my buttons because the clicks just don't come through.

So: Can somebody confirm that it is NOT a good idea to do what I am doing (showing an alert, adding a subview in viewDidDisappear), because then I will have to change the flow. If it should be okay, I have to figure out what else is causing this effect.


I'd put the callback into viewWillDisappear: instead. At least then the original UIView reference is still around.


Better solution would be to dismiss the modal view through the parent controller by adding the caller as a delegate. The delegate would implement a protocol to dismiss the modal controller. Call the delegate protocol from the modal view, when you are ready to dismiss.


To avoid changing the flow, you could schedule a timer to show the alert, this will give a chance to the view controller code to complete

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜