跟踪页面卷曲模式关闭时的时间(关闭) [英] Tracking when the page-curl modal closes(is dismissed)
问题描述
我有一个页面卷曲模式工作.但是我需要能够跟踪用户何时单击页面curl关闭页面,以便可以看到一些变量.有没有我可以听的事件或某些代表可以打来电话告诉我这个事件?
I have a page-curl modal working. But I need to be able to track when the user hits the page curl to close the page so I can see some vars. Is there an event I can listen for or some delegate where I will get a call to tell me of this event?
非常感谢 -代码
推荐答案
您会在这里看到很多建议,提倡使用performSelector:withObject:afterDelay:
,并且在退出模态视图后稍作延迟即可采取行动,但是我认为可能会有更好的方法.
You'll see a lot of advice around here advocating the use of performSelector:withObject:afterDelay:
with a small delay to take action after the dismissal of modal views, but I think there may be a better approach.
自己生成通知.如果您控制以模态形式显示的视图,请在其控制器中使用viewDidDisappear:
方法生成我被解雇"通知,然后在主视图控制器(或其他位置)中进行订阅.取消模态视图后,页面取消卷曲动画完成后,将调用viewDidDisappear:
.
Generate the notification yourself. If you control the view that's being presented modally, use the viewDidDisappear:
method in its controller to generate an "I was dismissed" notification which you then subscribe to in your main view controller (or somewhere else). viewDidDisappear:
is called after the page uncurl animation completes upon dismissal of the modal view.
在最坏的情况下,视图可能以模态或其他方式呈现,您可以在呈现视图控制器上保持状态,以确保通知实际上与模态视图关闭相对应.
In the worst case, where the view may be presented modally or otherwise, you can keep state on the presenting view controller to ensure that the notification actually corresponds to a modal view dismissal.
出于完整性考虑,页面去卷曲过渡开始时会生成viewWillDisappear:
.
For completeness' sake, viewWillDisappear:
is generated when the page decurl transition starts.
这篇关于跟踪页面卷曲模式关闭时的时间(关闭)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!