Swift (from the book 《iOS Animations by Tutorials:Chapter 12》 released by http://www.raywenderlich.com/):
let photoLayer = CALayer()
@IBInspectable
var image: UIImage! {
didSet {
photoLayer.contents = image.CGImage
}
}
How can I implement the above syntax in objective-c? I know only to set the property of photoLayer and image like below:
@property (strong, nonatomic) CALayer *photoLayer;
@property (strong, nonatomic) IBInspectable UIImage *image;
But i do not know how to implement didset{...}
parts using objective-c syntax, please help!
photoLayer.contents = image != nil ? image.CGImage : nil
– Roseroseann-setImage:
method. – Extroversion