구조가 어떻게 보이는지입니다.사용자 정의 테이블 뷰 셀의 버튼이있는 행을 삭제합니다.
--- UIView
---- ScrollView
--- TableView
.
UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, -250, 320, 250)];
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 70, 320, 150) style:UITableViewStylePlain];
tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
tableView.delegate = self;
tableView.dataSource = self;
tableView.backgroundColor = [UIColor blackColor];
tableView.separatorStyle = normal;
[tableView reloadData];
[topView addSubview:tableView];
[self.scrollView addSubview:topView];
tableview에서 나는 사용자 정의 tableview 셀에 버튼이 있습니다. 여기 내 CellForRowAtIndex에있는 버튼의 코드는
[cell.btnDelete addTarget:self action:@selector(deleteAppointment:) forControlEvents:UIControlEventTouchUpInside];
이제 내 deleteAppointment
UIButton *button = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)button.superview;
UITableView *tableView = (UITableView *)cell.superview;
NSIndexPath *indexPath = [tableView indexPathForCell:cell];
NSLog(@"row: %d",indexPath.row);
내가 이렇게 특정 행을 얻을하지만 여전히 다음과 같은 오류를주고있다.
-[ExceptionCell indexPathForCell:]: unrecognized selector sent to instance 0x210a2fa0
아무도 도와 줄 수 있습니까?
내 솔루션을 살펴 봐야합니다 – Marc