swift2

    4热度

    1回答

    进出口创造一个UIView动画: UIView.animateWithDuration(0.1, delay: 0, options: (.AllowUserInteraction | .Repeat | .Autoreverse), animations: {() -> Void in // Animate }, c

    2热度

    1回答

    我想添加一个UIAlertView中或控制器时,应用程序首次加载。目前,我在我的viewDidLoad方法中有此代码。 let welcomeAlert = UIAlertController(title: "hola", message: "this is a test.", preferredStyle: UIAlertControllerStyle.Alert) welcomeAlert.

    11热度

    2回答

    我使用雨燕2. 我用这个代码: while contains(currentCardValues, randomNumber + 1) { 我收到此错误: "contains" is unavailable: call the contains() method on the sequence

    0热度

    2回答

    我有一个新的“抛出” - “尝试”参数的问题。 我得到一个错误添加这些单词,所以我在IBAction函数的末尾添加了“throws”。 @IBAction func loginButtonPressed(sender: AnyObject)throws {//code here} 里面我是董一些无关痛痒的东西,然后这样的: let jsonData:NSDictionary = try NSJ

    6热度

    1回答

    我看到游乐场执行速度不可靠。例如用代码: import UIKit var count = 0; let startTime = NSDate() for i in 1...10000 { count++ } let endTime = NSDate() let interval = endTime.timeIntervalSinceDate(startTime) 的

    3热度

    2回答

    在夫特2 I具有以下协议 protocol Fightable { // return true if still alive, false if died during fight func fight (other: Fightable) -> Bool } protocol Stats { var defense: Int { get } var

    0热度

    2回答

    我尝试使用下面的代码: sprite.runAction(moveToAction, completion: nil) 错误说: 不能援引“ func redrawShape(shape: Shape, completion:() ->()) { for (idx, block) in shape.blocks.enumerate() { let sprite = blo

    3热度

    1回答

    为什么守卫让x = x在一个方法内的行为与外部不同? 下面的示例代码被从Playground复制出来。 var x:Int? = 3 func foo(x: Int?) { guard let x = x else { return } print(x) // print "3\n" } foo(x) guard let x = x els

    2热度

    2回答

    新的Xcode 7测试版已发布,我决定在其中构建一个iOS应用程序。现在我已经完成了在Swift 2.0中构建应用程序。当我打开二进制文件时,我刚完成上传。你不能用Beta版本的Xcode开发除beta版以外的应用程序 - 而且由于我在Swift 2.0中构建了应用程序,因此我无法使用先前版本的Xcode进行编译,并以此方式上传构建版本。 有没有什么办法可以让我的应用程序出来,还是我必须等到苹果发

    6热度

    2回答

    一直试图让这对雨燕2.0工作,错误说: 类型NSJSONWritingOptions不能遵守协议NilLiteralConvertible 在var options = prettyPrinted...: func JSONStringify(value: AnyObject,prettyPrinted:Bool = false) -> String { var options = p