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.

UITextField コードですぐに作る為メモ

Last updated at Posted at 2021-10-07

今回の内容

5C955AA8-57FD-4C28-848A-BC28B6287671_1_201_a.jpeg

コード

        let textfield01 = UITextField()
        textfield01.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 11, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield01.placeholder = "UITextField01"
        textfield01.layer.cornerRadius = 10.0
        textfield01.layer.borderWidth = 1.0
        textfield01.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield01.leftViewMode = .always
        textfield01.layer.borderColor = UIColor.black.cgColor
        textfield01.backgroundColor = .white
        textfield01.tag = 0
        view.addSubview(textfield01)
        
        let textfield02 = UITextField()
        textfield02.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 6.7, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield02.placeholder = "UITextField02"
        textfield02.layer.cornerRadius = 10.0
        textfield02.layer.borderWidth = 1.0
        textfield02.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield02.leftViewMode = .always
        textfield02.layer.borderColor = UIColor.black.cgColor
        textfield02.backgroundColor = .white
        textfield02.tag = 0
        view.addSubview(textfield02)
        
        let textfield03 = UITextField()
        textfield03.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 4.82, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield03.placeholder = "UITextField03"
        textfield03.layer.cornerRadius = 10.0
        textfield03.layer.borderWidth = 1.0
        textfield03.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield03.leftViewMode = .always
        textfield03.layer.borderColor = UIColor.black.cgColor
        textfield03.backgroundColor = .white
        textfield03.tag = 0
        view.addSubview(textfield03)
        
        let textfield04 = UITextField()
        textfield04.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 3.76, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield04.placeholder = "UITextField04"
        textfield04.layer.cornerRadius = 10.0
        textfield04.layer.borderWidth = 1.0
        textfield04.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield04.leftViewMode = .always
        textfield04.layer.borderColor = UIColor.black.cgColor
        textfield04.backgroundColor = .white
        textfield04.tag = 0
        view.addSubview(textfield04)
        
        let textfield05 = UITextField()
        textfield05.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 3.08, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield05.placeholder = "UITextField05"
        textfield05.layer.cornerRadius = 10.0
        textfield05.layer.borderWidth = 1.0
        textfield05.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield05.leftViewMode = .always
        textfield05.layer.borderColor = UIColor.black.cgColor
        textfield05.backgroundColor = .white
        textfield05.tag = 0
        view.addSubview(textfield05)
        
        let textfield06 = UITextField()
        textfield06.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 2.61, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield06.placeholder = "UITextField06"
        textfield06.layer.cornerRadius = 10.0
        textfield06.layer.borderWidth = 1.0
        textfield06.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield06.leftViewMode = .always
        textfield06.layer.borderColor = UIColor.black.cgColor
        textfield06.backgroundColor = .white
        textfield06.tag = 0
        view.addSubview(textfield06)
        
        let textfield07 = UITextField()
        textfield07.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 2.26, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield07.placeholder = "UITextField07"
        textfield07.layer.cornerRadius = 10.0
        textfield07.layer.borderWidth = 1.0
        textfield07.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield07.leftViewMode = .always
        textfield07.layer.borderColor = UIColor.black.cgColor
        textfield07.backgroundColor = .white
        textfield07.tag = 0
        view.addSubview(textfield07)
        
        let textfield08 = UITextField()
        textfield08.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 1.997, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield08.placeholder = "UITextField08"
        textfield08.layer.cornerRadius = 10.0
        textfield08.layer.borderWidth = 1.0
        textfield08.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield08.leftViewMode = .always
        textfield08.layer.borderColor = UIColor.black.cgColor
        textfield08.backgroundColor = .white
        textfield08.tag = 0
        view.addSubview(textfield08)
        
        let textfield09 = UITextField()
        textfield09.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 1.79, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield09.placeholder = "UITextField09"
        textfield09.layer.cornerRadius = 10.0
        textfield09.layer.borderWidth = 1.0
        textfield09.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield09.leftViewMode = .always
        textfield09.layer.borderColor = UIColor.black.cgColor
        textfield09.backgroundColor = .white
        textfield09.tag = 0
        view.addSubview(textfield09)
        
        let textfield10 = UITextField()
        textfield10.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 1.62, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield10.placeholder = "UITextField10"
        textfield10.layer.cornerRadius = 10.0
        textfield10.layer.borderWidth = 1.0
        textfield10.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield10.leftViewMode = .always
        textfield10.layer.borderColor = UIColor.black.cgColor
        textfield10.backgroundColor = .white
        textfield10.tag = 0
        view.addSubview(textfield10)
        
        let textfield11 = UITextField()
        textfield11.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 1.48, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield11.placeholder = "UITextField11"
        textfield11.layer.cornerRadius = 10.0
        textfield11.layer.borderWidth = 1.0
        textfield11.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield11.leftViewMode = .always
        textfield11.layer.borderColor = UIColor.black.cgColor
        textfield11.backgroundColor = .white
        textfield11.tag = 0
        view.addSubview(textfield11)
        
        let textfield12 = UITextField()
        textfield12.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 1.363, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield12.placeholder = "UITextField12"
        textfield12.layer.cornerRadius = 10.0
        textfield12.layer.borderWidth = 1.0
        textfield12.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield12.leftViewMode = .always
        textfield12.layer.borderColor = UIColor.black.cgColor
        textfield12.backgroundColor = .white
        textfield12.tag = 0
        view.addSubview(textfield12)
        
        let textfield13 = UITextField()
        textfield13.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 1.2635, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield13.placeholder = "UITextField13"
        textfield13.layer.cornerRadius = 10.0
        textfield13.layer.borderWidth = 1.0
        textfield13.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield13.leftViewMode = .always
        textfield13.layer.borderColor = UIColor.black.cgColor
        textfield13.backgroundColor = .white
        textfield13.tag = 0
        view.addSubview(textfield13)
        
        let textfield14 = UITextField()
        textfield14.frame = CGRect(x: view.frame.maxX / 10, y: view.frame.maxY / 1.178, width: view.frame.width - (view.frame.maxX / 5), height: 50)
        textfield14.placeholder = "UITextField14"
        textfield14.layer.cornerRadius = 10.0
        textfield14.layer.borderWidth = 1.0
        textfield14.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 0))
        textfield14.leftViewMode = .always
        textfield14.layer.borderColor = UIColor.black.cgColor
        textfield14.backgroundColor = .white
        textfield14.tag = 0
        view.addSubview(textfield14)

終わり

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

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?