坦率地說,我知道如何插入新的自定義行結束沒有reloadData,但現在我想知道的是如何插入新的自定義行UITable end end而reloadData。在reloadData插入新的自定義行同時reloadData Xcode
這是我的一段代碼插入新的自定義行,而reloadData。但是新插入的行出現在表格的頂部,這不是我想要的。
CoachPadItem *newCoachPadItem = [[CoachPadItem alloc]init];
newCoachPadItem.coachpadDescription = textView.text;
newCoachPadItem.coachpadTagId = @"0";
[_tagPointsArray addObject:newCoachPadItem];
[_coachpadTableView reloadData];
的cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Configure the cell...
CoachPadPointCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CoachPadPointCell" forIndexPath:indexPath];
if (cell == nil) {
cell = [[CoachPadPointCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CoachPadPointCell"];
}
counter += 1;
cell.tagBtn.hidden = YES;
cell.btnRemove.hidden = YES;
cell.tagBtn.userInteractionEnabled = canEdit;
[cell.tagBtn addTarget:self action:@selector(removeTag:) forControlEvents:UIControlEventTouchUpInside];
[cell.btnRemove addTarget:self action:@selector(removePad:) forControlEvents:UIControlEventTouchUpInside];
cell.btnRemove.tag = counter;
cell.txtPoint.delegate = self;
cell.txtPoint.tag = counter;
cell.txtPoint.textContainer.maximumNumberOfLines = 2;
cell.tagBtn.tag = counter;
cell.txtPoint.textAlignment = NSTextAlignmentLeft;
cell.txtPoint.backgroundColor = [UIColor clearColor];
cell.txtPoint.userInteractionEnabled = canEdit;
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
CoachPadItem *curr = _tagPointsArray[indexPath.row];
cell.txtPoint.text = cure.MyDesc;
return cell;
}
請幫助我如何把新的一行UITable結束?你在你的cellForRowAtIndexPath
方法使用_tagPointsArray
,你能否告訴裝載電池'cellforrowatindexpath'的方法呢? – anhtu
@anhtu我已經修改我的問題,因爲添加cellforrowatindexpath。謝謝。 – ppshein
應將新行插入底部。太奇怪了。 – anhtu