[Swift] How to set an image in the background without using UIImageView.

Introduction

I thought that I would set ImageView to Storyborad when using an image as the background, but I found that it can be done in the same way as setting backgroundcolor, so I summarized it briefly as a memorandum.

Preparation

・ Create a new project in Xcodo ・ Prepare an image to be used as a background スクリーンショット 2020-12-18 13.33.48.png

Implementation

viewDidLoad


 self.view.backgroundColor = UIColor(patternImage: UIImage(named: "backgoroundImage.jpg ")!)

Complete

スクリーンショット 2020-12-18 13.59.45 (1) (1).png

reference

How to set background image in Xcode using swift?

Summary

I was able to easily set the image in the background. This article has become more of a memorial element, but I hope it will be of some help to anyone looking for a way to set an image in the background.

Recommended Posts

[Swift] How to set an image in the background without using UIImageView.
[Rails 6] How to set a background image in Rails [CSS]
[Rails] How to display an image in the view
How to add sound in the app (swift)
[Swift] How to get the number of elements in an array (super basic)
Try adding text to an image in Scala using the Java standard library
How to make an image partially transparent in Processing
How to set the display time to Japan time in Rails
Mandels to create an image of the Mandelbrot set
JavaFX-Load Image in the background
How to use git with the power of jgit in an environment without git commands
How to set chrony when the time shifts in CentOS7
How to pass an object to Mapper in MyBatis without arguments
How to retrieve the hash value in an array in Ruby
How to control transactions in Spring Boot without using @Transactional
How to set Lombok in Eclipse
[Swift5] How to get an array and the complement of arrays
How to make an image posted using css look like an icon
How to output the value when there is an array in the array
[Android Studio] Set an arbitrary image for the application background [Java]
How to solve the unknown error when using slf4j in Java
Set up a Wordpress Docker environment without using the Worpdress image
[Swift] How to implement the Twitter login function using Firebase UI ②
How to get the length of an audio file in java
How to crop an image with libGDX
[swift5] How to specify color in hexadecimal
Shorten the UUID to base64 in Swift.
How to blur an image (super easy)
[Java] How to set the Date time to 00:00:00
[Swift] How to implement the countdown function
How to get the date in java
[Swift5] How to implement animation using "lottie-ios"
How to implement image posting using rails
How to overwrite Firebase data in Swift
Display the background image in the production environment
[Swift] How to pass the Label value in the selected collectionViewCell to the destination TextField
How to set the indent to 2 single-byte spaces in the JAXB implementation of the JDK
How to return a value from Model to Controller using the [Swift5] protocol
How to set tabs and spaces to be visible by using the tab key to insert spaces in Java files in Eclipse
How to get the ID of a user authenticated with Firebase in Swift
[Swift] How to implement the LINE login function
[Swift] How to generate an ID to uniquely identify a certain thing (using UUID)
How to implement the breadcrumb function using gretel
How to implement image posting function using Active Storage in Ruby on Rails
[Swift] How to link the app with Firebase
[Swift] How to change the order of Bar Items in Tab Bar Controller [Beginner]
[Java] (for MacOS) How to set the classpath
[Swift] How to implement the fade-in / out function
How to set when "The constructor Empty () is not visible" occurs in junit
How to set environment variables in the properties file of Spring boot application
How to solve an Expression Problem in Java
How to execute tasks in parallel in Swift in Swift Package
How to build the simplest blockchain in Ruby
Push the image to docker hub using Jib
How to build an executable jar in Maven
How to check Rails commands in the terminal
[Android development] Get an image from the server in Java and set it in ImageView! !!
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
[Swift] How to simply describe dismiss that was not taught in the introductory book
How to get the class name of the argument of LoggerFactory.getLogger when using SLF4J in Java
How to set the log level to be displayed in the release version of orhanobut / logger