坦率地说,我知道如何插入新的自定义行结束没有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