swift博客资源等:https://discussions.udacity.com/t/swift-documentation/23
1.how to build image vector:
http://martiancraft.com/blog/2014/09/vector-images-xcode6/
2.how was the pdf format created:
https://www.quora.com/How-was-the-PDF-format-created
3.Explanation of strong and weak storage in iOS5:
http://stackoverflow.com/questions/9262535/explanation-of-strong-and-weak-storage-in-ios5
https://docs.google.com/document/d/1JwUYa_lNeDHMizRGXG8hhnyunSCB3Nna_T6ZqIQ8Zwo/pub?embedded=true
大意是:swift不允许有明确类型的变量有nil值,因此如果要用nil则变量需要被声明为: int?或者int!
int? : 每次使用(expression)都需要unwrap 且只在 if中自动unwrap 即:
1.var x: Int x = nil错误 var y: Int? y = nil正确
2.if var x = o { } 正确
3. var o: Int? var x: Int o = Int(someString) x=o // Not legal
int!:自动解包装
现在说原因:
So, why are IBOutlets declared as Implicitly Unwrapped Optionals? The UIButton and UILabel properties in our ViewController class fit the profile for variables that should be declared as Implicitly Unwrapped Optionals. Here are the two key criteria that tip us off:
- ● They need to be nil when the object is created.
- ● We can guarantee that they are not nil when we use them.
They need to be nil when the ViewController object is created because the Storyboard mechanism does not set their values when init is invoked. But they will be set by the timeviewDidLoad is invoked.
5. UIKit 联系和使用
reference:https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKit_Framework/index.html