Does anyone else see this issue? I am using a segmented control, and I’ve overridden it so that when the user hits the same segment(index), it is deselected.
This worked fine in previous versions, but now testing on iOS5. And I am finding that the UIControlEventValueChanged is not sent when you tap on the same segment. So the code works ok when you tap on different segments, but does not for the same segment.
My code.
segmentCtrl = [[MySegmentedControl alloc] initWithItems: segmentCtrlLabels];
segmentCtrl.segmentedControlStyle = UISegmentedControlStyleBar;
// Register for touch events
[segmentCtrl addTarget:self action:@selector(segmentedCtrlTouched:) forControlEvents:UIControlEventValueChanged];
I tried to register for UIControlEventTouchUpInside, and get the same behavior.
Any suggestions for work around?
Regards,
Yenyi
Fixed it by registrering for a touch event. If the touched segment is the same, I manually send the EventChanged event.