[Swift] Simple implementation of UIImageView

Introduction

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.

How to use

Place the UIImageView and connect it as an Outlet. Name it as you like (easy to understand). スクリーンショット 2020-12-27 14.18.21.png

Select the red frame and drag and drop the photo or illustration in the blue frame. スクリーンショット 2020-12-27 14.19.14.png I entered like this. スクリーンショット 2020-12-27 14.22.24.png 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 スクリーンショット 2020-12-27 14.25.08.png

code

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")
    }
}
Execution result

スクリーンショット 2020-12-27 14.35.27.png

Recommended Posts

[Swift] Simple implementation of UIImageView
[Swift] Implementation of ultra-simple billing
[Swift 5] Implementation of membership registration with Firebase
Implementation of GKAccessPoint
SKStoreReviewController implementation memo in Swift UI of iOS14
Implementation of flash messages
Implementation of search function
Applied implementation of chat-space
Implementation of pagination function
Ruby on Rails <2021> Implementation of simple login function (form_with)
Implementation example of simple LISP processing system (Java version)
[Swift] This is the solution! Illustration of Delegate implementation
Implementation example of simple LISP processing system (Ruby version)
Rails implementation of ajax removal
[Swift] Types of types-Basic knowledge-
[Swift] Simple screen transition summary
Implementation of sequential search function
About simple operation of Docker
Implementation of like function (Ajax)
[Rails 6] Implementation of search function
Implementation of image preview function
[Java] Implementation of Faistel Network
Implementation of XLPagerTabStrip with TabBarController
[Rails] Implementation of category function
Implementation of category pull-down function
Implementation of unit test code
Implementation of gzip in java
[Rails] Implementation of tutorial function
[Rails] Implementation of like function
Implementation of tri-tree in Java
Implementation of HashMap in kotlin
Introduction purpose of ActiveHash and simple flow to application implementation
Implementation example of simple LISP processing system [Summary of each language version]
[Rails] Implementation of user logic deletion
[Rails] Implementation of CSV import function
[Rails] Asynchronous implementation of like function
[Rails] Implementation of image preview function
Implementation of ls command in Ruby
[Swift] Change the textColor of UIDatePicker
Easy implementation of Android file browsing
[Swift] Acquisition of IDFA on iOS14
[Rails] About implementation of like function
[Rails] Implementation of user withdrawal function
[Rails] Implementation of CSV export function
The basic basis of Swift dialogs
Implementation of asynchronous processing in Tomcat
[Swift] Advantages and disadvantages of Storyboard
Implementation of validation using regular expressions
[Rails] Implementation of many-to-many category functions
Animated display of Swift error messages
Default implementation of Object.equals () and Object.hashCode ()
Implementation of like function in Java