如何在iOS中使用下划线创建分段控件
如何在iOS中使用下划线创建分段控件(如左侧图像)?
据我所知,它与Android原生控件类似。
谢谢
UISegmentedControl
包含用于自定义其外观的API。 使用-setBackgroundImage:forState:barMetrics:
设置各种状态组合的图像-setBackgroundImage:forState:barMetrics:
和-setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics:
.
您还可以使用-setTitleTextAttributes:forState:
自定义文本。
可以在UISegmentedControl
文档的Customizing Appearance部分中找到这些方法。