Force iPhone to show default image, not snapshot
I have an app that needs to download data from a server whenever it becomes active. The app presents a simple view that uses Default.png as its background and UIActivityIndicatorView
while it waits for the data. This works fine when the app is first launched, but does not look good if the app was sitting in the background since the device uses the last snapshot to animate the launch.
I can solve this problem by preventing the app from running in the background. However, that introduces all new set of issues. Inserting a view with Default.png on applicationWillResignActive
seem开发者_C百科s to be one way to achieve what I need, but I wanted to make sure there is no designed way to accomplish this.
So, is there a way to force the device to use the default image and not the last snapshot?
You thought of both possibilities: Not running in the background and putting up a placeholder view before entering the background. However, you should insert the view during applicationDidEnterBackground:
as applicationWillResignActive:
is also called when there is an interruption, such as a push notification or phone call (unless you also load the data when coming back from them).
精彩评论