2011-11-27 51 views
0

如何設置用於iPhone ios 4.3的UISegmentedControl的字體顏色?如何設置UISegmentedControl for iPhone的字體顏色ios 4.3

爲iOS 5.0,我使用

UISegmentedControl *button = [[[UISegmentedControl alloc] 
initWithItems:[NSArray >arrayWithObjects:itemTitle, nil]] autorelease]; 

NSDictionary *attributes = [NSDictionary dictionaryWithObject:fontColor forKey:UITextAttributeTextColor]; 
[button setTitleTextAttributes:attributes forState:UIControlStateNormal]; 


button.momentary = YES; 
button.segmentedControlStyle = UISegmentedControlStyleBar; 
button.tintColor = tintColor;  

回答

1

它可能不是使用自定義的項目,特別是因爲OS 4.x版不具備深厚的UIKit定製可能在5.x中一個壞主意這是Github的一個很好的例子,它實際上解決了您設置UIControl的大小和顏色的兩個要求:Here

編輯:它看起來像項目自動選擇字體顏色以匹配選定的顏色。至少這是一個開始。

相關問題