Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had this kind of problems with tableview many times before. The best solution I found so far is creating my own "reuseTableViewCellWithIdentifier" method (in myViewController.m) and then using it to get the cell in "cellForRowAtIndexPath method". In your case it will be like this :</p> <pre><code>-(UITableViewCell *)reuseTableViewCellWithIdentifier:(NSString *)identifier withIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; FailedBankInfo *info = [_fetchedResultsController objectAtIndex:indexPath.row]; CGRect infoFrame = CGRectMake(10, 10, 200, 16); UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoFrame]; infoLabel.textColor = [UIColor blackColor]; infoLabel.backgroundColor = [UIColor yellowColor]; infoLabel.font = [UIFont systemFontOfSize:12]; infoLabel.textAlignment = NSTextAlignmentCenter; infoLabel.tag = 101; infoLabel.text = [NSString stringWithFormat:@"%@, %@", info.city, info.state]; [cell.contentView addSubview:b]; return cell; } </code></pre> <p>Now you just need to get the Label with its tag and change its value in your cellForRow method like this :</p> <pre><code> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (nil == cell) { cell = [self reuseTableViewCellWithIdentifier:CellIdentifier withIndexPath:indexPath]; } UILabel *infoLabel = (UILabel *)[cell.contentView viewWithTag:101]; FailedBankInfo *info = [_fetchedResultsController objectAtIndex:indexPath.row]; infoLabel.text = [NSString stringWithFormat:@"%@, %@", info.city, info.state]; return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload