CGRect = [accountTextField ];
.size.width = 7.0f;
UIView *leftview = [[UIView alloc] initWith : ];
accountTextField.leftViewMode = UITextFieldViewModeAlways;
accountTextField.leftView = leftview;
多个textfield的时候不要用一个leftview,
比如:
错误例
UIView *aLeftview = [[UIView alloc] initWith : ]
aTF.leftView = aLeftview;
bTF.leftView = aLeftview;
cTF.leftView = aLeftview;
摘自http://blog.163.com/china_uv/blog/static/117137267201462132642700/
感谢china_uv博友
新编辑补充
改变边框:
textField. .cornerRadius = 8.0f;//圆角 textField. .masksToBounds = YES; textField. .borderColor = [[UIColor redColor]CGColor]; textField. .borderWidth = 1.0f;//边框宽