I figure out by checking the option Momentary
. Thanks
Handler tap of UISegmentControl to order data by ASC and DESC
-
17-06-2023 - |
문제
I try to handler 2 tap on a UISegmentControl
without success.
I add a target to my listener with UIControlEventValueChanged
and it work but only if the segment is not selected.
That my function that handle tap, the target is made with the storyboard:
- (IBAction)changeFilterAction:(UISegmentedControl *)paramSender {
NSInteger selectedIndex = [_segmentControlFilter selectedSegmentIndex];
NSLog(@"Test");
}
To resume:
I try to ORDERBY data by ASC and DESC. When i tap for the first time i post a ASC request and i would like that when i tap for the second time it post DESC request.
Any help would be appreciated :)
해결책 2
다른 팁
You will try to add Custom UIButton
with clear color and place it to the UISegmentControl
.
For Example :
UIButton * overButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0, 0.0, segControl.frame.size.width/numOfSegments, segControl.frame.size.height)];
[overButton addTarget:segControl action:@selector(overTapped:) forControlEvents:UIControlEventTouchUpInside];
[segControl addSubview:overButton];
//Adjust your `overButton` frame as per your selected Segment index
Thanks!
제휴하지 않습니다 StackOverflow