ios - 动画代码错误: Type of expression is ambiguous without more context

标签 ios swift xcode6 uiviewanimation xcode7-beta2

我在 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/

相关文章:

ios - 快速为一个 View Controller 启用纵向和横向,而仅为其他 View Controller 启用纵向?

ios - 动态类型检查混淆 Swift

ios - 在 UIsplitView 中更改主按钮的标题

swift - 编译时间慢 - Xcode 6.x

ios - 快速避免索引超出范围错误

ios - UISplitViewController Detail View 旋转后消失

ios - 如何在 iOS 6 中将 Tab Bar 的背景颜色更改为半透明

ios - **** 的重新声明无效

xcode - 无法将表达式类型 UIImage 转换为类型 void swift

ios - XCode 6中 Storyboard 和xib的自动约束?