嗨,我有一個表格視圖,可以添加和刪除單元格。但是當我刪除自帶的應用程序的唯一細胞,我嘗試添加一個新的細胞與「梅根道」的文字,只是自動文本改變它自身的原始細胞的文字是「樓1」在這裏我的代碼!UITableView的BUG,增加細胞犯規插入文本所需
- (IBAction)saveButton:(id)sender {
FacePlatesViewController * viewController = (FacePlatesViewController
*)self.parentViewController;
[viewController addObject:[NSMutableDictionary dictionaryWithObject:text.text
forKey:@"name"]];
[self dismissModalViewControllerAnimated:YES];
}
- (IBAction)cancel:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero
reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.text = [[cells objectAtIndex:indexPath.row] valueForKey:@"name"];
UIImage * myimage = [UIImage imageNamed: @"check.png"];
image = [[UIImageView alloc]initWithImage:myimage];
tableView.backgroundColor = [UIColor clearColor];
self.myTableView = tableView;
}
return cell;
}
這是保存按鈕!任何幫助將是非常讚賞:d感謝
我們需要FacePlatesViewController的代碼才能幫助您解決這個問題。 –
我真的懷疑這是一個UITableView的錯誤,正如標題所述。 – EmilioPelaez