Here is my code for the UIControlEventValueChanged
event for a UISegmentedControl
:
- (void)segmentAction:(id)sender{
if([sender selectedSegmentIndex] == 0){
pendingIsShowing = YES;
[freeCutsTable reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
}else if([sender selectedSegmentIndex] == 1){
pendingIsShowing = NO;
[self showAvailableCuts:sender];
[freeCutsTable reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
}
}
My problem is when the value is changed, the [self showAvailableCuts:sender]
is called, but the segment control no longer changes its index. If I comment out the method call, it works fine...What I tried to do was pass in the segmented control into [self showAvailableCuts:sender]
and change it that way, but to no avail...
- (void)showAvailableCuts:(id)sender{
if(!pendingIsShowing){
NSString *path =@"https://WebserviceURL";
NSString* escapedUrl = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//[sender setSelectedIndex:1];
NSLog(@"%@", escapedUrl);
[self parseXMLFileAtURL:escapedUrl];
}
}
I'm not sure why this is occurring...