我有一个应用程序,我正在使用 nsmutablearray 来控制一个表格视图,我是这样以编程方式创建的。`
tableview = [[UITableView alloc] init];
[tableview setFrame:CGRectMake(self.view.frame.origin.x,44,self.view.frame.size.width, self.view.frame.size.height)];
tableview.dataSource = self;
tableview.delegate = self;
[self.view addSubview:tableview];
self.tableview.rowHeight = 55;
[tableview release];
.then i have an nsmutable array which is an instance array.when it is first loading everything seems to be working fine.i am storing that mutable array to the nsuserdefaults.from the second time onwords i am trying to load the data from the nsuserdefaults array like this.
NSUserDefaults *userslist = [NSUserDefaults standardUserDefaults];
NSArray *arrayObj = [userslist objectForKey:@"userslist"];
NSMutableArray *searchfriendarray1=[NSMutableArray arrayWithArray:arrayObj];
searchfriendarray=searchfriendarray1;
.thats 也工作。但在一个方法中,我试图编辑该数组,然后尝试重新加载表,重新加载表没有被调用。`
[sortedFriendsArray removeAllObjects];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"userslist"];
[[NSUserDefaults standardUserDefaults]synchronize ];
NSDictionary *dictionary = [self.searchfriendarray objectAtIndex:index];
[dictionary setValue:@"offline" forKey:@"TYPE"];
NSUserDefaults *userslist = [NSUserDefaults standardUserDefaults];
[userslist setObject:searchfriendarray forKey:@"userslist"];
`在此之后从我的数组创建排序数组。但是当我调用 [self.tableview reloadData]; 它没有重新加载。有谁能够帮助我?