If I have my data in an NSArray, and I can NSLog that data in my -cellForRowAtIndexPath method, would there be any reason why I wouldn’t be able see the data in my UITableView using code like:
static NSString *simpleIdentifier = @"SimpleIdentifier";
UITableViewCell *simpleCell = [tableView dequeueReusableCellWithIdentifier:simpleIdentifier];
if (simpleCell == nil) {
simpleCell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleIdentifier];
}
NSUInteger row;
row = [indexPath row];
simpleCell.textLabel.textColor = [UIColor whiteColor];
simpleCell.selectionStyle = UITableViewCellSelectionStyleNone;
simpleCell.textLabel.text = [_categoriesArray objectAtIndex:row];
return simpleCell;
I’m wondering if I missed a “gotcha” or something. I have this data verbatim in one popover and it works fine. But then when I put it in another popover, it shows nothing. So I’m stumped! Any help would be great. Thanks.
Thank you everyone for trying to help me troubleshoot this problem. It was not a color issue. I finally got it to work, but I’m not quite sure why. Maybe someone else can chime in as why it works now. So in my cellForRowAtIndexPath method and other datasource methods, I have code like
When I first had it working, I had a popover from a button that would show tableView1, then you would select a row in that table, to present another popover like _categoriesTableView. So this code worked fine. However, when I would try to change the first popover to show the _categoriesTableView, leaving all other code the same, no data would show correctly. Then instead of replacing the tableView1 initializing data for the popover, I still initialized it, but just did not present it in the popover, and now everything works. Not sure why the uninitialized memory of tableView1 would cause the problem since when I followed the code with breakpoints, my “do real stuff” was run, just wouldn’t do what it was supposed to (display the data in the UITableView).