Text in UISegmentedControl not exactly centered?

最后都变了- 提交于 2020-01-06 08:25:14

问题


Maybe it's just me, but it seems like the bottom padding is greater than the top padding for the text in this UISegmentedControl. Why is this happening?


回答1:


The position is probably correct, but it looks wrong to your eye because room is left for a descender, and there are no descenders because the titles are all caps. Luckily, you can adjust the y-component of the content position! There are two ways:

  • In Interface Builder, in the attributes inspector for each segment, set the Content Offset

  • In code, call setContentPositionAdjustment:forSegmentType:barMetrics:



来源:https://stackoverflow.com/questions/21617801/text-in-uisegmentedcontrol-not-exactly-centered

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!