本文介绍了如何以编程方式闪烁屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
经过长时间的搜索后,我不得不放弃要求。
可以闪光屏
如果是,那么如何?
感谢您提供答案。
解决方案
将白色全屏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];
}
编辑:动画结束后不要忘记删除该视图
After long time of searching I have to give up and ask.
Is it possible to flash screen (just like in taking screenshot using home button + power button) ?
If yes, then how ?
Thanks in advance for answers.
解决方案
Add the white full-screen UIView to the window and animate it's alpha (play with duration and animation curve to get result that you want):
-(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];
}
Edit: don't forget to remove that view after animation is ended
这篇关于如何以编程方式闪烁屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!