【发布时间】:2016-01-12 14:12:19
【问题描述】:
这是我的一段代码:
NSMutableDictionary *newDict = [[NSMutableDictionary alloc] init];
NSDictionary oldDict = (NSDictionary )[dataArray objectAtIndex:0];
[newDict addEntriesFromDictionary:oldDict];
[newDict setObject:@"Don" forKey:@"Name"];
[dataArray replaceObjectAtIndex:0 withObject:newDict];
[self.tblview reloadData];
我必须重新加载我的tableview。但是tableview没有重新加载。如何纠正它。
【问题讨论】:
-
显示你的
cellForRow -
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {if(tableView == self.tblviewProject) {self.tblviewProject.hidden = YES; NSString *pname = [[self.projectArray objectAtIndex:indexPath.row] objectForKey:@"name"]; NSMutableDictionary *newDic = [[NSMutableDictionary alloc] init]; NSDictionary *rowchange = (NSDictionary *) [self.dataArray objectAtIndex:[self.projIndexPath intValue]]; [newDic addEntriesFromDictionary:rowchange]; [newDic setObject:pname forKey:project]; [self.tblview beginUpdates];
-
[self.dataArray replaceObjectAtIndex:[self.projIndexPath intValue] withObject:newDic]; [self.tblview reloadData]; [self.tblview endUpdates]; }}
-
这是我的行单元格...现在我添加了 begin 和 endupdates 但它不起作用。
-
@RBH 不要将代码放入 cmets。将您的代码放入您的问题中。
标签: ios objective-c uitableview nsarray