Friday, 2 January 2015

swift learning diary

todo list



calculator

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

https://www.youtube.com/watch?v=2Ovip9_iQ4Q


















No comments:

Post a comment