0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Swift】UIImageViewを使わずに背景に画像をセットする方法。

Last updated at Posted at 2020-12-18

はじめに

背景に画像を使用する際にStoryboradにImageViewをセットすると思っていたのですが、backgroundcolorのセットと同じようにできることがわかったので備忘録をかねて簡単にまとめました。

準備

・Xcodoに新規プロジェクトを作成
・背景に使用する画像を準備
スクリーンショット 2020-12-18 13.33.48.png

実装

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

完成

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

参考

swiftを使ってXcodeで背景画像を設定するには?

まとめ

簡単に背景に画像をセットする事ができました。
今回の記事は自分の備忘録的な要素が強くなってしまったのですが、背景に画像をセットする方法を探している人の参考に少しでもなれたら嬉しいです。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?