0
我在我的一個viewControllers中使用了一個名爲getCurrentCycle
的方法,我在基於標籤的應用程序中使用該方法。我想從applicationDidBecomeActive
應用程序委託方法調用此方法。在基於標籤的應用程序中發送消息給viewController(iphone iOS)
有人可以幫我解決這個問題嗎?
我在我的一個viewControllers中使用了一個名爲getCurrentCycle
的方法,我在基於標籤的應用程序中使用該方法。我想從applicationDidBecomeActive
應用程序委託方法調用此方法。在基於標籤的應用程序中發送消息給viewController(iphone iOS)
有人可以幫我解決這個問題嗎?
查看NSNotification Class Reference。
在具有getCurrentCycle
方法控制器,添加以下內容:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCurrentCycle:) name:@"getCurrentCycle" object:nil];
當你想調用getCurrentCycle
,補充一點:
[[NSNotificationCenter defaultCenter] postNotificationName:@"getCurrentCycle" object:nil];
此外,您將需要更改getCurrentCycle
到:
- (void)getCurrentCycle:(NSNotification *)notification