这是我的UIControlEventValueChanged
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];
}
}
我的问题是当值改变时,[self showAvailableCuts:sender]
调用了,但是段控件不再改变它的索引。如果我注释掉方法调用,它工作正常......我试图做的是将分段控件传入[self showAvailableCuts:sender]
并以这种方式进行更改,但无济于事......
- (void)showAvailableCuts:(id)sender{
if(!pendingIsShowing){
NSString *path =@"https://WebserviceURL";
NSString* escapedUrl = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//[sender setSelectedIndex:1];
NSLog(@"%@", escapedUrl);
[self parseXMLFileAtURL:escapedUrl];
}
}
我不确定为什么会发生这种情况......