사용자 정의 셀을 UITableView
용으로 사용 중이며 UIButton
이 있으므로 테이블보기에서 현재 셀을 제거해야합니다. cellForRowAtIndexPath
에서 나는 올바른 셀UITableView에서 사용자 정의 셀을 제거 할 수 없습니다.
-(void) removing
{
[TOperations deleteTickerFromGroup:tickerGroupID andTickerSymbol:selectedSymbol];
NSNumber *selectedRowIndex1 = [NSNumber numberWithInteger:currentIndexPath.row];
[tableView1 beginUpdates];
NSIndexPath *previousPath = [NSIndexPath indexPathForRow:selectedRowIndex1.integerValue-1 inSection:0];
[tableView1 endUpdates];
[tableView1 reloadData];
}
이제 문제는이 표시되어 있는지 애니메이션을 제거
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"CellIdentifier";
NSLog(@"Creating Cell");
FADynamicCell *cell= (FADynamicCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
cell = [[[NSBundle mainBundle]loadNibNamed:NSStringFromClass([FADynamicCell class])
owner:nil
options:nil] lastObject];
}
currentIndexPath = indexPath;
UIButton *removeButton = [UIButton buttonWithType:UIButtonTypeCustom];
removeButton.tag = indexPath.row +100;
removeButton.frame = cell.removeButton.frame;
removeButton.backgroundColor = [UIColor colorWithRed:255./255 green:65./255 blue: 21./255 alpha:1];
removeButton.titleLabel.font = [UIFont systemFontOfSize:12];
removeButton.titleLabel.textAlignment = NSTextAlignmentCenter;
[removeButton setTitle:@"Remove" forState:UIControlStateNormal];
[removeButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[removeButton addTarget:self action:@selector(removing) forControlEvents:UIControlEventTouchUpInside];
[cell addSubview:removeButton];
return cell;
}
그리고 기능에
을하고있는 중이 야하지만 난 테이블에서 사용자 정의 셀을 제거 할 수 없습니다입니다 전망. 그리고 다시보기를로드 할 때마다, 즉 다른 화면에서 오는 경우 제거를 위해 클릭 한 셀이 표시되지 않습니다.어떤 도움을 이해할 수있을 것이다 ...
데이터 소스에 문제가있을 수 있습니다. 다른 화면에서 왔을 때 항목이 남아 있는지 확인하십시오. –
@Sviatoslav Yakymiv : 위의 코드에서 @Atul 이전에 – Atul
@Atul 버튼을 눌렀다면 다른 화면에서 들어 왔을 때 테이블 뷰의 데이터 소스가 누락 된 것 같습니다. –