将数据传递给AppDelegate [英] Pass data to AppDelegate
本文介绍了将数据传递给AppDelegate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何将数据传回AppDelegate。假设我有这个方案
I wonder how to pass data back to AppDelegate. Let's say I have this scheme
AppDelegate - > RootViewController -> FirstViewController -> SecondViewController.
当调用AppDelegate applicationWillTerminate方法时,SecondViewController具有应保存的数据。我知道我可以使用单例来共享应用程序中的数据,但我不喜欢这种方法。
The SecondViewController have data which should be saved when AppDelegate applicationWillTerminate method is called. I know that I can use singleton to share data in the application but I don't like this approach. Notification seems will not work in this scenario.
你可以推荐我什么?
推荐答案
这个应该得到那个代理。
this should get that delegate.
AppDelegate * delegate =(AppDelegate*) [UIApplication sharedApplication].delegate
[delegate callSomeMethod:someData];
这篇关于将数据传递给AppDelegate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文