Assigning an image to a UIImageView
suggest changeYou can assign an image to a UIImageView
during initialization, or later using the image
property:
// Swift
UIImageView(image: UIImage(named: "image1"))
UIImageView(image: UIImage(named: "image1"), highlightedImage: UIImage(named: "image2"))
imageView.image = UIImage(named: "image1")
// Objective-C
[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1"];
[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1"] highlightedImage:[UIImage imageNamed:@"image2"]];
imageView.image = [UIImage imageNamed:@"image1"];
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents