ios - UISegmentedControl 中的文本不完全居中?

标签 ios objective-c cocoa-touch uisegmentedcontrol

可能只是我的问题,但对于此 UISegmentedControl 中的文本,底部填充似乎大于顶部填充。为什么会发生这种情况?

enter image description here

最佳答案

位置可能是正确的,但在您看来是错误的,因为为下行字母留有空间,而没有下行字母,因为标题都是大写字母。幸运的是,您可以调整内容位置的 y 分量!有两种方式:

  • 在 Interface Builder 中,在每个段的属性检查器中,设置内容偏移量

  • 在代码中,调用setContentPositionAdjustment:forSegmentType:barMetrics:

关于ios - UISegmentedControl 中的文本不完全居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21617801/

相关文章:

objective-c - UITableViewCell 中的 UITextField 不会成为第一响应者

iPhone内存管理(属性(property)专用)

iphone - 当文本更改时,有哪些方法可以吸引人们对 UIBarButtonItem 的注意?

iphone - iOS 应用程序 UI 自动化测试的最佳资源

android - 将 android/java 移植到 ios/objective c 的好书

iOS:调用原生录音机

objective-c - cocoa /ObjC : Are there any performance drawbacks to my style of allocing objects for property iVars?

ios - UICollectionView scrollToItem() 滚动到上一个单元格无法正常工作

ios - Interface Builder 中 deviceRGB 和 calibratedRGB 的区别?

ios - 为 iOS 构建时,cocoa-pods 库中出现重复符号