0

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

1 回答 1

0
mySegmentedControl.momentary = YES;

我相信这是你想要的。

于 2012-09-05T16:50:41.303 回答