当来自锁屏iphone时,重新绘制GUI上的didreceivelocalnotification [英] redraw GUI on didreceivelocalnotification when come from lock screen iphone

查看:104
本文介绍了当来自锁屏iphone时,重新绘制GUI上的didreceivelocalnotification的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在收到UILocalNotification后从锁定屏幕返回时阻止我的GUI重绘?在didReceiveLocalNotification中,我提供了一个模态视图,但我的视图控制器的旧状态在此之前显示了一会儿。如何防止这种情况?

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

当我来自锁屏时:

1. didReceiveLocalNotification
2. UIApplicationDidBecomeActiveNotification

为什么会出现这种差异以及是否还有其他问题我是遗失?

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

谢谢

推荐答案

以下是它的解决方法。可能不是这样,但它对我有用。由于我的应用程序是voip / audio,它没有来到 didFinishLaunchingWithOptions ...我发现,当它恢复时iOS使用来自先前状态的缓存图像来制作动画从背景或睡眠模式。所以解决方案基本上是用我的default.png图像交换这个缓存的图像。我在 applicationWillResignActive 委托中执行此操作。在那里,我添加了一个带有 Default.png 图片的模态视图,并在 applicationDidBecomeActive 中将其关闭。这真的很简短。希望它能帮助其他人解决同样的问题。

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.

这篇关于当来自锁屏iphone时,重新绘制GUI上的didreceivelocalnotification的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆