开发者

When I select any segment in segmentControll it doesnot show highlighted

NSArray *itemArray = [NSArray arrayWithObjects:@"one", @"Two", @"Three", nil];
segmentControl = [[UISegmentedControl alloc] initWithItems:itemA开发者_运维百科rray];
segmentControl.frame = CGRectMake(5, 5, 325, 35);
segmentControl.segmentedControlStyle = UISegmentedControlStyleBar;
segmentControl.tintColor = [UIColor blackColor];

[self changeUISegmentFont:segmentControl];
//[self.view addSubview:segmentControl];
self.navigationItem.titleView = segmentControl;
[segmentControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];

This is my code of segment control and my problem is ..

When I select any segment it does not show me that that segment is selected.. I mean it is not shown highlighted..

can Anyone tell me what the problem is??


Change the following line in your code.


segmentControl.tintColor = [UIColor blackColor];

to

segmentControl.tintColor = [UIColor grayColor];

Actually the segment is getting selected but It is not visible to you, because black color is the default color in selected mode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜