美文网首页
UITextField

UITextField

作者: CaptainRoy | 来源:发表于2019-08-04 16:11 被阅读0次
    override func viewDidLoad() {
            super.viewDidLoad()
            
            let textField = UITextField(frame: CGRect(x: 20.0, y: 60.0, width: 200.0, height: 30.0))
            textField.borderStyle = UITextField.BorderStyle.roundedRect
            textField.placeholder = "请输入...."
            textField.adjustsFontSizeToFitWidth = true
            textField.minimumFontSize = 10.0
            self.view.addSubview(textField)
            
            textField.returnKeyType = .join
            textField.delegate = self
            textField.clearButtonMode = .whileEditing    
        }
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
            
            NSLog("textField - %@", textField.text!)
            NSLog("textFieldShouldReturn")
            return true
        }
    

    相关文章

      网友评论

          本文标题:UITextField

          本文链接:https://www.haomeiwen.com/subject/myjydctx.html