[cpp] view plain copy textField.textAlignment = UITextAlignmentLeft; //水平左对齐 textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; //垂直居中 运行效果如下: