iOS Property List and Views学习笔记(Lesson 5)

斯坦福课程(Developing iOS 8 Apps with Swift),lesson 5


1、CGFloat: Always use this instead ofDouble or Float for anything to do with a UIView's coordinate system.

可以与Float,Double转换:varcfg = CGFloat(aDouble)


2、NSString is bridged to String.(String is struct )

   NSArray is bridged to Array<Anyobject>

   NSDictionary is bridged toDictionary<NSObject, Anyobject>


3、Property List is really just thedefinition of a term.

 

4、A view, a subclass of the class UIViewin iOS represents a rectangular area on the screen.

 

5、A UIViews' initializer is different ifit comes out of a storyboard.

Init(frame: CGRect) //initializer if the UIView is created in code

Init(coder: NSCoder) //initializer if the UIView comes out of astoryboard

 

6、If you need an initializer, implementthem both

Implement T:

 

func setup() {…}

 

override init(frame: CGRect) {

super.init(frame: frame)

setup()

}

 

required override init(coder aDecoder: NSCoder) {

super.init(coder: aDecoder)

setup()

}

 

7、 Origin is upper left.

Units are points, not pixels.

Most of the time there are 2 pixels per point, but it could be only1 or something else

How many pixels per point are there?   UIView's var contentScalaFactor: CGFloat

It will return the number of pixels per point.

 

8、 frame and center, which are aboutposition, bounce which is your size and area that you're drawing into your owncoordinate system. (frame center 用来定位视图的, bounds 用来在视图自身的坐标系中确定大小和区域的)



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值