本文介绍了我如何垂直居中的UITextField的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是实例化一个的UITextField
,并注意到,该文本不垂直居中。相反,它是我的按钮,我觉得,因为我希望默认垂直居中的一种奇怪的顶部齐平。我怎样才能居中垂直,或者是有,我错过了一些默认设置?
解决方案
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
I am simply instantiating a UITextField
and noticing that the text doesn't center vertically. Instead, it is flush with the top of my button, which I find kind of odd since I would expect the default to center it vertically. How can I center it vertically, or is there some default setting that I am missing?
解决方案
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
这篇关于我如何垂直居中的UITextField的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!