我需要以下行为:
用户点击主页按钮,即可将我的应用留在“应用内设置”视图中。然后他/她在iphone设置视图中进行了一些更改,然后再次打开我的应用程序。我需要使用哪种方法添加代码才能在“应用内设置”视图中更新用户界面?
提前致谢
答案 0 :(得分:1)
将简历代码放入app delegate .m文件中的- (void) applicationDidBecomeActive:(UIApplication *)application
或- (void)applicationWillEnterForeground:(UIApplication *)application
函数中。当用户点击主页按钮后你的应用程序再次启动时,将调用此函数
apple的文档更详细地解释了用于某些任务的功能:
答案 1 :(得分:1)
将此添加到您的AppDelegate:
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the active state: here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
viewWillAppear未被调用,因为当应用程序处于后台/暂停时,视图仍然存在。