简体   繁体   English

如何为UISegmentedControl按钮设置不同的颜色?

[英]How to set up different colors for UISegmentedControl buttons?

I have an UISegmentedControl with two buttons. 我有一个带有两个按钮的UISegmentedControl I want each button of control to have specific color of borders and title. 我希望控件的每个按钮都有特定的边框和标题颜色。

Is is possible and if yes how it can be archived? 是可能的,如果可以,如何将其归档?

You can use segmentedControlStyle property. 您可以使用segmentedControlStyle属性。 Which gives you 3 different styles 这给你3种不同的风格
UISegmentedControlStylePlain, UISegmentedControlStyleBordered, UISegmentedControlStyleBar . UISegmentedControlStylePlain, UISegmentedControlStyleBordered, UISegmentedControlStyleBar If you want any other appearance, you'll need to make a custom control. 如果需要其他外观,则需要进行自定义控件。

Doc: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UISegmentedControl_Class/Reference/UISegmentedControl.html#//apple_ref/occ/instp/UISegmentedControl/segmentedControlStyle Doc: http : //developer.apple.com/iphone/library/documentation/UIKit/Reference/UISegmentedControl_Class/Reference/UISegmentedControl.html#//apple_ref/occ/instp/UISegmentedControl/segmentedControlStyle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM