我在 Xcode 7 beta 2 中输入了一些简单的动画代码-
UIView.animateWithDuration( 0.5, delay: 1, options: nil, animations: ({
self.W.frame = CGRect(x: 107, y: 268, width: 30, height: 33)
self.nameLabel.alpha = 0
self.wd.alpha = 0
} ), completion:{ finished in
UIView.animateWithDuration(0.5, animations: ( { ()-> Void in self.wd.alpha = 1 } ), completion: {finished in
UIView.animateWithDuration(0.5, delay: 1, options: nil, animations: ({()-> Void in
self.greenLaunchScreenView.alpha = 0
self.nameLabel.alpha = 0
self.wd.alpha = 0
self.W.alpha = 0
self.launchScreenCircle.alpha = 0
self.navigationController?.setNavigationBarHidden( false, animated: true )
}), completion: nil )
}
)})
当我在 Xcode 6 中输入相同的代码时,它工作得很好,但它在 Xcode 7 beta 2 中不起作用,因为它给了我一个错误 - “表达式类型在没有更多上下文的情况下不明确”。 如何使此代码在 Xcode 7 beta 中工作?
最佳答案
在 Xcode 7 (Swift 2) 中,UIView 中的参数
.options:
请使用 []
代替 nil
。 animateWithDuration
关于ios - 动画代码错误: Type of expression is ambiguous without more context,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31740690/