【发布时间】:2015-02-24 06:44:51
【问题描述】:
为了从这里转换一个 Objective C 示例:How to flash screen programmatically? 我编写了以下代码:
func blinkScreen(){
var wnd = UIApplication.sharedApplication().keyWindow;
var v = UIView(frame: CGRectMake(0, 0, wnd!.frame.size.width, wnd!.frame.size.height))
wnd!.addSubview(v);
v.backgroundColor = UIColor.whiteColor()
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(1.0)
v.alpha = 0.0;
UIView.commitAnimations();
}
但我不确定我应该在哪里添加 UIView v 删除代码(在动画结束时执行的某些事件上......但是如何?)。另外-我的转换正确吗?
【问题讨论】:
标签: ios flash swift screenshot