Swift UITextField常用方法

        let textfiled = UITextField();
        textfiled.frame = CGRect.init(x:100,y:250,160,height:30);
        textfiled.borderStyle = UITextBorderStyle.roundedRect;
        textfiled.placeholder = "请输入用户名";
        textfiled.adjustsFontSizeToFitWidth = true;
        textfiled.minimumFontSize = 1;
        textfiled.textAlignment = .right;
        textfiled.contentVerticalAlignment = .bottom;
        textfiled.borderStyle = .none;
        textfiled.background = UIImage(named:"");
        self.view.addSubview(textfiled);

详细代码查看:https://github.com/xiaolitou-ping/Swift-All

原文地址:https://www.cnblogs.com/laolitou-ping/p/7681631.html