This question is a result of another one in which开发者_如何学C i didn't knew how to update NSUserDefaults from a Settings bundle with multitasking. Now i do (thanks to @mvds), placing the refreshDefaults code inside the app delegate, in applicationWillEnterForeground.
The problem is, the code implies a change in the view (background color, etc) so when i come back to the app after changing the setting, the view is displayed and only afterwards is called applicationWillEnterForeground.
This is, it shows the previous "theme" and then it changes to the new one. Is there any way to overcome this, to notify of the change before the app gets displayed? The result is ugly and i just don't see any method in the lyfecicle that might be called before.
When an app is going in background mode, the system take a screenshot of the current state. When the app is comming back in foreground, it is first displaying this screenshot while loading back the application.
If you change your theme colors, what you see in the first place is this screenshot, and then the view is displayed and updated. You can not change this behaviour.
The only thing you can do is try to display something different in the WillEnterBackground
method, like an empty UI or a splashscreen.
精彩评论