IOS_小资源/问题列表

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

大意:
   ownership:strong
  无ownership:weak,不能阻止释放
  当strong的连接没了,就释放,weak连接同时置空.
4. Why are IBOutlet properties declared with exclamation points?:

  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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值