开发者

redraw GUI on didreceivelocalnotification when come from lock screen iphone

How do I prevent my GUI from redraw when it comes back from lock screen after receiving a UILocalNotification? In didReceiveLocalNotification I present a modal view, but the old state of my view controllers is shown for a moment before that. How do I prevent this?

Also the order of events I get when I 开发者_运维问答come back on local notification from background is as following:

1. UIApplicationWillEnterForegroundNotification
2. UIApplicationDidBecomeActiveNotification
3. didReceiveLocalNotification

When I come from lock screen:

1. didReceiveLocalNotification
2. UIApplicationDidBecomeActiveNotification

Why is this difference and whether there is something else I'm missing?

Thanks


Here's how it was solved. May be it's not the way, but it worked for me. Since my application is voip/audio, it doesn't come to didFinishLaunchingWithOptions... I found out, that iOS uses a cached image from a previous state for animation when it resumes from background or from sleep mode. So the solution is basically to exchange this cached image with my default.png image. I do it in applicationWillResignActive delegate. There I add a modal view with a Default.png picture and dismiss it in applicationDidBecomeActive. This is really in short. Hopefully it will help somebody else with the same problem.


You can provide a custom image that is displayed when launching/resuming from a local notification. Simply set the alertLaunchImage property on your local notification to the name of the correct image.

From the Docs:

The string is a filename of an image file in the application bundle. This image is a launching image specified for a given notification; when the user taps the action button (for example, “View”) or moves the action slider, the image is used in place of the default launching image. If the value of this property is nil (the default), the system either uses the previous snapshot, uses the image identified by the UILaunchImageFile key in the application’s Info.plist file, or falls back to Default.png.

alertLaunchImage

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜