UITableView赢得';t重新加载
(已解决) 我有一个UITableView,它在开始时填充了一些对象。在使用过程中,tableView的NSMutableArray将获得一些新项。但是当我执行UITableView赢得';t重新加载,uitableview,refresh,reloaddata,Uitableview,Refresh,Reloaddata,(已解决) 我有一个UITableView,它在开始时填充了一些对象。在使用过程中,tableView的NSMutableArray将获得一些新项。但是当我执行[myTableView重载数据],什么也没发生。 myTableView是头文件中的IBOutlet 有什么想法吗/ 编辑:以下是我的tableView方法: -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the numb
[myTableView重载数据]代码>,什么也没发生。
myTableView是头文件中的IBOutlet
有什么想法吗/
编辑:以下是我的tableView方法:
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.mutableArrayFuerTableView count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cellFavoriten = [tableView dequeueReusableCellWithIdentifier:@"favoritenCell"];
NSString *favoritenString = [self.mutableArrayFuerTableView objectAtIndex:indexPath.row];
cellFavoriten.textLabel.text = favoritenString;
return cellFavoriten;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Do some stuff when the row is selected
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
这在viewDidLoad中:
self.myTableView.dataSource = self;
self.favoritenArray = [NSMutableArray arrayWithCapacity:300];
defaultsFuerFavoritenTableView = [NSUserDefaults standardUserDefaults];
mutableArrayFuerAnderenMutableArray = [defaultsFuerFavoritenTableView objectForKey:@"favoritenKeyUserDefaults"];
mutableArrayFuerTableView = [NSMutableArray arrayWithArray:mutableArrayFuerAnderenMutableArray];
我编辑了帖子:)对不起,变量名是德语的,希望你能理解。das passt mir gut,uber你确定MutableArrayFurtableView大小正在更改吗?你能发布更改此数组的代码吗?因为你的表数据源和委托是正确的。打开此视图时,它不会更改大小。我有另一个视图控制器,在其中我将一个数组保存到NSUserDefaults。当在这个VC中调用viewDidLoad时,所以当我用我的选项卡打开它时,这个数组将被初始化并由UserDefaults填充。所以它应该改变数据。啊,我解决了它!没有调用我的viewDidLoad,因此它没有刷新。在VIEWDID中,我现在有这样一个选项:[self-viewDidLoad];[self-reloadTableView]
解决了这个问题,谢谢!