Friday, 2 January 2015

swift learning diary

todo list


For the code: println("button clicked \(bn.titleLabel?.text?)");
The result will be : button clicked Optional("7")
If you don't want it print Optional("") for you, you should unwrap it.
Two way to do this:
By using !, be aware that, all wrapped variables should be unwrapped. for example bn.titleLabel!.text!
Or you do  like this:
        if let xxx = bn.titleLabel?.text?{
            println("xxx= " + xxx)


draggable images

No comments:

Post a comment