延迟applicationDidEnterBackground屏幕捕获 [英] Delay applicationDidEnterBackground screen capture
问题描述
当应用程式进入背景时,是否有延迟iOS的萤幕撷取的方法?原因是,我有时显示一个视图,当用户转到主屏幕我希望此视图删除,所以它不显示,当应用程序恢复。这个视图是一个 SSHUDView
(源代码 here ),我在 applicationWillResignActive
中调用 dismissAnimated:NO
。这实际上工作在模拟器,但不是在真实设备( SSHUDView
仍然显示,当恢复)。任何人都有一个线索如何处理这?
Is there a way to delay the screen capture made by iOS when app is entering background? The reason is that I'm sometimes showing a view when the user goes to home screen I want this view removed so it doesn't show when app is resumed. The view in question is a SSHUDView
(source code here) which I call dismissAnimated:NO
in applicationWillResignActive
. This actually works in the simulator but not on real device (the SSHUDView
still shows when resuming). Anyone have a clue how to deal with this?
推荐答案
如果你看看 SSHUDView
实现它使用一个 UIWindow
实例来显示内容;它使自己的UIWindow的关键 UIWindow
:
If you have a look at the SSHUDView
implementation it uses a UIWindow
instance to display the content; it makes it's own UIWindow the key UIWindow
:
[_hudWindow makeKeyAndVisible];
这可能是为什么它是如此棘手的摆脱。您可能会尝试做 c> SSHUDView 在它关闭后将焦点返回主窗口后执行
Which is probably why it's so tricky to get rid of. You might try to do what SSHUDView
does after it dismisses itself to return focus to the main window:
[[[[UIApplication sharedApplication] windows] objectAtIndex:0] makeKeyWindow];
当hud视图自行关闭时,它会发送 resignKeyWindow
到它的私有 _hudWindow
对象,你可能会尝试获取一个句柄,然后你返回焦点到主窗口,如下:
When the hud view dismissed itself it sends resignKeyWindow
to it's private _hudWindow
object, you could possibly try to get a handle on that before you return focus to the main window, like so:
[[[[UIApplication sharedApplication] windows] objectAtIndex:1] resignKeyWindow];
但它可能会导致意想不到的问题,因为您绕过 SSHUDView
API ...
But it may cause unexpected problems because you're bypassing the SSHUDView
API...
这篇关于延迟applicationDidEnterBackground屏幕捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!