I will write about how to implement UIImageView.
I feel that it looks really good just by displaying photos on the screen.
I think that I will use it frequently in the future, so I will summarize it.
Place the UIImageView and connect it as an Outlet. Name it as you like (easy to understand).
Select the red frame and drag and drop the photo or illustration in the blue frame. I entered like this. Change the name of the photo to make it easier to understand. You will also specify this Name when you call it later in the code. This time I chose sea. Probably a river, but lol
You can display the image by entering the name you set earlier in UIImage (named :).
class ViewController: UIViewController {
@IBOutlet var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
imageView.image = UIImage(named: "sea")
}
}
Recommended Posts