Я не могу заставить свой UITableView отображать мои проанализированные элементы.Вот мой код:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
//elementsArray is a NSArray that is declared in .h
elementsArray = [document selectElements: @"name"];
[myTable reloadData];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [elementsArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil){
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
}
cell.textLabel.text = [elementsArray objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
Мой NSLog распечатывает все элементы, но элементы не отображаются в UITableView.Все отлично подключено, все делегаты и т. Д. Это работает, если я определяю статический NSArray следующим образом:
NSArray * elementsArray = [NSArray arrayWithObjects:@"name1",@"name2",@"name3",nil];
Я не понимаю, почему он не работает.Любая помощь будет оценена.Спасибо.