Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.92 KB | None | 0 0
  1. class WelcomeViewController: UIViewController {
  2.  
  3.   private let signInButton: UIButton = {
  4.     let button = UIButton()
  5.     button.backgroundColor = .none
  6.     button.layer.borderWidth = 2
  7.     button.clipsToBounds = true
  8.     button.setTitle("apple idでログイン".uppercased(), for: .normal)
  9.     button.setTitleColor(.systemBackground, for: .normal)
  10.     return button
  11.   }()
  12.  
  13.   override func viewDidLoad() {
  14.     super.viewDidLoad()
  15.    
  16.     title = "タイトル"
  17.     view.backgroundColor = .systemGreen
  18.     view.addSubview(signInButton)
  19.     signInButton.addTarget(self, action: #selector(didTapSignIn), for: .touchUpInside)
  20.   }
  21.  
  22.   override func viewDidLayoutSubviews() {
  23.     super.viewDidLayoutSubviews()
  24.     signInButton.frame = CGRect(x: 20, y: view.height - 50 - view.safeAreaInsets.bottom, width: view.width - 40, height: 50)
  25.     signInButton.layer.cornerRadius = signInButton.frame.size.height / 2
  26.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement