问题描述:

I have a main view which have container view which is holding a tableview. And when I pass my data array to the container view what to update de tableview, but nothing happen. It seems the tableview is not display the cell even the container get the array data.

Any idea about this! Thank you so much. Anything seems working but just not show the table data

// 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;

}

相关阅读:
Top