First you create a UIImage
from your image file, then create a UIImageView
from that:
let imageName = "yourImage.png"
let image = UIImage(named: imageName)
let imageView = UIImageView(image: image!)
Finally you'll need to give imageView
a frame and add it your view for it to be visible:
imageView.frame = CGRect(x: 0, y: 0, width: 100, height: 200)
view.addSubview(imageView)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…