这是我的代码,我想将字体大小更改为视图宽度,我正在改变,但对齐失真。
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool
{
inputText.contentVerticalAlignment = UIControlContentVerticalAlignment.Center
inputText.contentHorizontalAlignment = UIControlContentHorizontalAlignment.Center
inputText.textAlignment = NSTextAlignment.Center
inputText.adjustsFontSizeToFitWidth = true
return true
}