[英]In App Delegate call method from another class
我有一個視圖,其中包含滾動視圖和一些子視圖(UIViewControllers)。 我想在ApplicationWillResignActive:App Delegate方法中從一個類(UIViewControllers之一)調用一個方法(停止計時器)。
實現這個的最佳方法是什么?
不要擔心在您的app委托中處理該事件並將其傳遞。 只需注冊您對處理該事件感興趣的任何課程的通知:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(someMethod:)
name:UIApplicationWillResignActiveNotification
object:nil];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.