簡體   English   中英

iOS 7 UISegmentControl設置色調顏色不起作用

[英]IOS 7 UISegmentControl set tint color not working

iOS 7 UISegmentControl設置色調顏色不起作用。 我要如何解決?

這是我添加的代碼:

UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems:[NSMutableArray arrayWithObjects:@"YES",@"NO", nil]];

[segmentControl setTintColor:[UIColor orangeColor]];

但是顏色只出現在邊框上,我希望它為整個背景着色。

正如我從圖書館提到的那樣,

@property(nonatomic) UISegmentedControlStyle segmentedControlStyle NS_DEPRECATED_IOS(2_0, 7_0, "The segmentedControlStyle property no longer has any effect");*

UISegmentedControl與UINavigationBar的顏色有關。 如果更改顏色,則UISegmentedControl的着色顏色將相應更改。

[[UINavigationBar appearance]  setTintColor:[UIColor blackColor]];

我想您可能想要:

[segmentControl setBackgroundColor:[UIColor orangeColor]];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM