Animation code Error: Type of expression is ambiguous without more context
Animation code Error: Type of expression is ambiguous without more context
我在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 中不起作用,因为它给我一个错误- "Type of expression is ambiguous without more context" .
我怎样才能让这段代码在 Xcode 7 beta 中工作?
在Xcode7(Swift2)中,UIView.animateWithDuration
中的参数options:
请用[]
代替nil
。
我在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 中不起作用,因为它给我一个错误- "Type of expression is ambiguous without more context" . 我怎样才能让这段代码在 Xcode 7 beta 中工作?
在Xcode7(Swift2)中,UIView.animateWithDuration
中的参数options:
请用[]
代替nil
。