LoginSignup
0
1

More than 1 year has passed since last update.

UITextFieldのレイアウト(メモ)

Last updated at Posted at 2021-10-09

まえがき

• notionでメモ程度に書いてるのをQiitaでまとめてみた!
• 自分用

TextFieldの境界線幅の設定

 textField.layer.borderWidth = 1       
 textField.layer.borderColor = UIColor.secondaryLabel.cgColor
幅とカラーはお好みで

レイアウトイメージ

何も設定しない場合

スクリーンショット 2021-10-09 16.02.34.png

textField.layer.borderWidth = 1 の場合 (カッケェー)

スクリーンショット 2021-10-09 16.06.54.png

textField.layer.borderWidth = 10 の場合 (煉獄並の太眉)

スクリーンショット 2021-10-09 16.03.45.png

エンターキーの設定

textField.returnKeyType = .continue
色んな種類があるからやってみてねー

スクリーンショット 2021-10-09 13.06.08.png

TextField内に空白を作る

textField.leftViewMode = .always
textField.leftView = UIView(frame: .init(x: 0,
                                         y: 0,
                                         width: 50,
                                         height: 0))
幅はお好みに

幅指定がある場合この場合は50のスペースがある

スクリーンショット 2021-10-09 15.59.05.png

指定しない場合

スクリーンショット 2021-10-09 15.57.59.png

終わりに

誰かの参考になれば幸いです
Qiitaさんいつもお世話になってるので感謝
間違えてるところ等ありましたら教えてくださいー

参考

https://developer.apple.com/documentation/uikit/uitextfield
https://qiita.com/apukasukabian/items/39ed1711520f6a0aa013

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