小编Riy*_*ker的帖子

Swift中的UIView动画不起作用,错误的参数错误

我正在尝试制作动画并使用下面的代码.我得到"无法使用类型'的参数列表调用'animateWithDuration'(FloatLiteralConvertible,延迟:FloatLiteralConvertible,选项:UIViewAnimationOptions,动画:() - >() - > $ T4,完成:(布尔) - >(Bool ) - > $ T5)'"错误.

这意味着我使用了错误的参数.我错了.请帮忙.我无法真正解决它.

var basketTopFrame = CGRect()
basketTopFrame = dropPlace.frame
var mytimer : NSTimer = NSTimer .scheduledTimerWithTimeInterval(2.0, target: self, selector: "restart", userInfo: nil, repeats: false)

UIView.animateWithDuration(1.0, delay: 0.1, options: UIViewAnimationOptions.CurveEaseIn , animations: {  var pickPlace = basketTopFrame }, completion:  {(finished: Bool) in mytimer })
Run Code Online (Sandbox Code Playgroud)

提前致谢.

uiviewanimation ios swift

7
推荐指数
1
解决办法
2899
查看次数

应用内购买还原

我正在尝试进行应用内购买,除了还原外,一切正常.以下是我写的代码:

func paymentQueueRestoreCompletedTransactionsFinished(queue:SKPaymentQueue!)
{
    for transaction:AnyObject in queue.transactions
    {
        let trans : SKPaymentTransaction = transaction as SKPaymentTransaction
        var identifier : NSString = trans.payment.productIdentifier
        println(identifier)
    }
}
Run Code Online (Sandbox Code Playgroud)

我在这里遇到的问题是我没有在purchased identifier这里.我想我错了代码.

in-app-purchase ios swift

6
推荐指数
1
解决办法
1103
查看次数

在Swift中为NSString分配[NSDate date]

在Objective C中,我们可以轻松地将当前日期分配给NSString string = [NSDate date];.

有人可以帮助我如何在Swift中分配相同的内容吗?提前致谢.

nsdate nsstring ios swift

5
推荐指数
2
解决办法
6853
查看次数

在SWIFT中为UIAlertController设置标签?

如何在swift中为警报视图设置标记.我无法设置标签alert.tag = 1,如果我这样做,我会收到类似的错误'UIAlertController' does not have a member named 'tag'.以下是我写的代码,

var alert = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "YES", style: UIAlertActionStyle.Default, handler:{ (ACTION :UIAlertAction!)in }))
alert.addAction(UIAlertAction(title: "NO", style: UIAlertActionStyle.Default, handler:{ (ACTION :UIAlertAction!)in }))

alert.tag = 1 // Error is shown here

self.presentViewController(alert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

我们曾经在Obj-C中为警报视图设置标签.有人可以帮我这个.提前致谢.

ios swift uialertcontroller

3
推荐指数
2
解决办法
2961
查看次数

在Xcode 6.1中.'UIImage的?' 没有名为'size'的成员错误

我正在获取图像,Size并使用下面的代码.它的工作非常好Xcode 6.0.1.更新后Xcode 6.1,我得到错误:

'UIImage?' does not have a member named 'size'

var image = UIImage(named: imageName)
let sizeOfImage = image.size
Run Code Online (Sandbox Code Playgroud)

这是我的代码或Apple的错误吗?请帮帮我.TIA.

uiimage swift xcode6

2
推荐指数
1
解决办法
8271
查看次数