What is the difference between UIImage
and UIImageView
? Can someone explain it with an example?
UIimage
is an Object which stores data (Jpg, png...)
and UIImageView
class which contains UIImage
as a property.
UIImageView
can have multiple UIImages
, and UIImage
is immutable.
That bothered me a long time ago, when you create an image you do:
var image: UIImageView!
But when you execute that "image" you do
image.image = UIImage.init(named: "image")
Its really easy, you use UIimageView
, to create an image with UIImage
.
UIImage
displays the image, and UIImageView
is a container for that UIImage
.