У меня есть основное представление с представлением контейнера, которое содержит табличное представление. И когда я передаю свой массив данных в представление контейнера, что нужно обновить в табличном представлении, но ничего не происходит. Кажется, что tableview не отображает ячейку, даже если контейнер получает данные массива.
Любая идея по этому поводу! Большое спасибо. Кажется, все работает, но просто не показывает данные таблицы
// parent view success call this method to pass the the array to this container view.
- (void)listMetricsToTable:(NSMutableArray*)obj{
self.myTableView.dataSource = self;
self.myTableView.delegate = self;
allMetrics = obj;
NSLog(@"pass data : %@", allMetrics);
NSLog(@"count : %i",allMetrics.count);
[self.myTableView reloadData];
}
#pragma mark - Table view data source
- (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.
// Usually the number of items in your array (the one that holds your list)
NSLog(@"numberOfRowsInSection returning %d", [items count]);
return [items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//Where we configure the cell in each row
NSLog(@"call");
static NSString *CellIdentifier = @"Cell";
CustomCell *cell =[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell... setting the text of our cell's label
//NSDictionary *show = [allMetrics objectAtIndex:indexPath.row];
//cell.metricsLabel.text = [show objectForKey:@"number"];
//cell.metricsNameLabel.text = [show objectForKey:@"name"];
cell.metricsNameLabel.text = [items objectAtIndex:indexPath.row];
return cell;
}