LoginSignup
0
1

More than 3 years have passed since last update.

#23 Viewの背景を画像にする方法1例

Last updated at Posted at 2020-02-05

はじめに

個人のメモ程度の出来なのであまり参考にしないで下さい.

環境

Xcode:11.2.1
Swift:5.1.2
2019/11

part1

Assets.cassestsに画像をドロップする.

スクリーンショット 2020-02-05 午後10.39.49.png

追記

画像が選択された状態で,Attributes inspectorScalesSingle Scaleにする.

スクリーンショット 2020-02-24 午後2.25.24.png

part2

UIImageViewと検索する.

スクリーンショット 2020-02-05 午後10.40.32.png

part3

UIImageViewViewに全て覆うように置く.

スクリーンショット 2020-02-05 午後10.40.53.png

part4

UIImageViewに以下の4つの制約を付ける.

スクリーンショット 2020-02-05 午後10.41.08.png

part5

するとUIImageViewがズレるので,もう一度Viewに全て覆うようにする.

スクリーンショット 2020-02-05 午後10.41.28.png

part6

その状態で,Selected ViewsUpdate Constraint Constantsを選択する.

スクリーンショット 2020-02-05 午後10.41.37.png

part7

そのままUIImageViewを選択した状態で,Attributes inspectorImageから,先程追加した画像を選択する.

スクリーンショット 2020-02-05 午後10.41.59.png

part8

UIImageViewを選択した状態で,Attributes inspectorContent ModeScale To Fillを選択する.

スクリーンショット 2020-02-05 午後10.42.14.png

part9

ラベルやボタンよりも後にUIImageViewを配置すると,ラベルやボタンが隠れてしまうので,下の写真のように,UIImageViewSafe Areaの直下にドラッグ・ドロップする.

スクリーンショット 2020-02-05 午後11.04.53.png

スクリーンショット 2020-02-05 午後10.42.51.png

part10

以下のように,UIImageViewが再背面に移動している事を確認する.

スクリーンショット 2020-02-05 午後10.43.35.png

part11

Label Labelを選択して,Attributes inspectorShadowSystem Background Colorにする.

スクリーンショット 2020-02-05 午後10.44.04.png

part12

Label Labelを選択した状態で,Attributes inspectorShadow OffsetWidthHeight-1にする.

スクリーンショット 2020-02-05 午後10.44.38.png

part13

Button!を選択して,Attributes inspectorFontStyleBoldにする.

スクリーンショット 2020-02-05 午後10.45.07.png

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