Swift UITextField常用方法

        let textfiled = UITextField();
        textfiled.frame = CGRect.init(x:100,y:250,width: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

posted @ 2017-10-17 14:52  朝阳向日葵  阅读(406)  评论(0编辑  收藏  举报