Я пытаюсь обнаружить, если выбор UISegmentedControl изменен, чтобы сделать действие, но ничего не происходит, когда я изменить выбор, я получил UISegmentedControl из тега в ячейкеDetect выберите изменение в UISegmentedControl Из UITableView didSelectRowAtIndexPath
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
UISegmentedControl *doing = (UISegmentedControl *)[cell viewWithTag:512];
NSString *done = [NSString stringWithFormat:@"%@", [[_myarraytask objectAtIndex:indexPath.row]valueForKey:@"done"]];
if ([done isEqualToString:@"NO"]) {
doing.userInteractionEnabled = YES;
if(doing.selectedSegmentIndex==0){
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Task finish ?" message:@"Please confirm" preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"Confirm" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}]];
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self closeAlertview:(cell)];
}]];
dispatch_async(dispatch_get_main_queue(),^{
[self presentViewController:alertController animated:YES completion:nil];
});
}
}
}
БЛАГОДАРНОСТИ наконец-то –