我有一个问题:我有UISegmentedControl,有三个索引0,1,2。当我选择UISegmentedControl的索引时,它工作正常,但我需要多次触摸,应该重点如何才能实现。怎么可以编程再次点击选定的索引,它应该工作...
NSArray *segmentTextContent = [NSArray arrayWithObjects: allString, favoritesString,filterString, nil];
segmentedControl = [[UISegmentedControl alloc] initWithItems:segmentTextContent];
[segmentedControl setFrame:CGRectMake(60,10,200,30)];
[segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
//segmentedControl.momentary = YES;
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
segmentedControl.tintColor=[UIColor colorWithRed:36/255.0 green:61/255.0 blue:103/255.0 alpha:1];
segmentedControl.selectedSegmentIndex =0;
[toolBar1 addSubview:segmentedControl];
答案 0 :(得分:0)
mySegmentedControl.momentary = YES;
我相信这是你想要的。