经过长时间的寻找,我不得不放弃并询问。
是否可以闪屏(就像使用主页按钮+电源按钮截屏一样)?
如果是,那么如何?
提前感谢您的回答。
最佳答案
将白色全屏 UIView 添加到窗口并为其设置 alpha 动画(使用持续时间和动画曲线以获得您想要的结果):
-(void) flashScreen {
UIWindow* wnd = [UIApplication sharedApplication].keyWindow;
UIView* v = [[[UIView alloc] initWithFrame: CGRectMake(0, 0, wnd.frame.size.width, wnd.frame.size.height)] autorelease];
[wnd addSubview: v];
v.backgroundColor = [UIColor whiteColor];
[UIView beginAnimations: nil context: nil];
[UIView setAnimationDuration: 1.0];
v.alpha = 0.0f;
[UIView commitAnimations];
}
编辑:不要忘记在动画结束后删除该 View
关于iphone - 如何以编程方式闪烁屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5254508/