frame和bounds的区别

1
2
3
var view: UIView?
let bounds = view?.bounds
let frame = view?.frame

bounds表示的只是view的大小, bounds的原点固定为(0, 0)
frame 表示的是view的大小和位置信息

所以设置初始化UIView用的是frame而不是bounds