[英]Is there a way to be notified when a view controller load a new view controller modally?
我需要收到有關模態視圖控制器演示的通知,我知道我可以使用NSNotificationCenter
發布並觀察我的自定義通知,但是我想知道這些通知是否已經存在。
謝謝,
安德里亞
我找到了解決方案。 我剛剛創建了一個抽象類,該類重寫了呈現模態視圖的方法,如下所示:
- (void) presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated{
[[NSNotificationCenter defaultCenter] postNotificationName:PresentingModal object:self];
[super presentModalViewController:modalViewController animated: animated];
}
當然,我所有的視圖控制器都繼承自它。
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.