代码改变世界

swift开发笔记21 - Pinterest

2017-12-21 15:29  dengchaojie_learner  阅读(404)  评论(0编辑  收藏  举报

let frame = CGRect(x: xOffset[column], y: yOffset[column], width: columnWidth, height: height)

let insetFrame = frame.insetBy(dx: cellPadding, dy: cellPadding)

 

attributes.frame.intersects(rect)

 

ceil(rect.height)

 

Variable 'photos' passed by reference before being initialized

var photos: [Photo]

 

if let photo = photo

Class 'AnnotatedPhotoCell' has no initializers

Initializer for conditional binding must have Optional type,

// 类方法

class func allPhotos() -> [Photo] {}

 

if let patternImage = UIImage.init(named: "Pattern") {
  view.backgroundColor = UIColor.init(patternImage: patternImage)
}

 

// model刷新UI;
var photo: Photo? {
didSet{
if let photo = photo {
imageView.image = photo.image
captionLable.text = photo.caption
commentLabel.text = photo.comment
}
}
}

DESIGNATED,CONVENIENCE 和 REQUIRED

 http://swifter.tips/init-keywords/