如何将UISegmentedControl设置为所选索引的多个触摸?

时间:2010-10-06 14:02:38

标签: iphone objective-c uisegmentedcontrol

我有一个问题:我有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];

1 个答案:

答案 0 :(得分:0)

mySegmentedControl.momentary = YES;

我相信这是你想要的。