Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试制作一个uisegmentcontrol,其中所选颜色不是蓝色。我也想改变如下图的风格。这两件事中的任何一件都可能吗?你是怎么做到的?
最简单的方法是使用实UISegmentedControl例方法使用自定义图像,例如setWidth:forSegmentAtIndex:,setImage:forSegmentAtIndex:和setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics
UISegmentedControl
setWidth:forSegmentAtIndex:
setImage:forSegmentAtIndex:
setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics
您也可以只使用UIButtons 来模仿 a 的行为UISegmentedControl
UIButton