2016-05-19 9 views
0

私のセグメント化されたコントロールに絵文字を入れたいのであれば、おそらく最初の行にイメージを取得したいのですが、2番目と3番目になります。UISegmentedControlで絵文字を消すのを防ぐ方法

enter image description here

私はそれをどのように修正することができますか?

答えて

2

ちょうどUIControlStateSelected状態のためのテキスト属性として@{NSForegroundColorAttributeName : [UIColor whiteColor]}を置く

@interface ViewController() 

@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentedControl; 

@end 

@implementation ViewController 

- (void)viewDidAppear:(BOOL)animated{ 
    [super viewDidAppear:animated]; 

    NSDictionary *dict = @{NSForegroundColorAttributeName : [UIColor whiteColor]}; 


    [self.segmentedControl setTitleTextAttributes:dict forState:UIControlStateSelected]; 
} 

@end 
関連する問題