0
0

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.

今日作成したUI記録(layerとAutoLayout)

Posted at

今回の内容

[06ABD96B-6362-4932-A845-254A09B86F86_4_5005_c.jpeg

コード

  • Main.storyboardで表示するパーツを作成しておきます.
    @IBOutlet weak var topWhiteView: UIView!
    @IBOutlet weak var beforeResultLabel: UILabel!
    @IBOutlet weak var beforeResultDateLabel: UILabel!
    @IBOutlet weak var beforeResultLocationLabel: UILabel!
    @IBOutlet weak var showSignUpViewButton: UIButton!

Layer

  • UILabelは3つとも同じ.cornerRadiusの値を設定してるので、UILabelを持つ配列を引数にしています。
static func topViewDesign(targetLabels:[UILabel],targetView:UIView,targetButton:UIButton){
        
        targetLabels.forEach({$0.layer.cornerRadius = 13.0; $0.layer.masksToBounds = true})
        
        targetView.layer.cornerRadius = 25.0
        targetView.layer.shadowOffset = CGSize(width: 10, height: 10)
        targetView.layer.shadowOpacity = 0.65
        targetView.layer.shadowRadius = 5
        
        targetButton.layer.cornerRadius = 20.0
        targetButton.layer.shadowOffset = CGSize(width: 10, height: 10)
        targetButton.layer.shadowOpacity = 0.65
        targetButton.layer.shadowRadius = 5
    }

tabBar

        tabBar.barTintColor = .systemGreen
        tabBar.tintColor = .white
        tabBar.unselectedItemTintColor = .systemIndigo
        
        tabBar.layer.cornerRadius = 25.0
        tabBar.layer.masksToBounds = true
        tabBar.layer.maskedCorners = [.layerMaxXMinYCorner,.layerMinXMinYCorner]
        

AutoLayout

89E530A9-4BDD-4F2C-A855-58C7ECCB3773_1_201_a.jpeg

終わり

ご指摘、ご質問などありましたら、コメントまでお願い致します。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?