Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are setting the text of the label only when creating a new cell. However, during cell reuse, new cell is not created. Hence your code for setting/changing text is not working. You can use this modified code.</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CellIdentifier"; UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:CellIdentifier]; UILabel *FileNameLabel=nil; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; FileNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 100, 30)]; FileNameLabel.tag = 1001; FileNameLabel.backgroundColor = [UIColor clearColor]; FileNameLabel.font = [UIFont fontWithName:@"Helvetica" size:16]; FileNameLabel.font = [UIFont boldSystemFontOfSize:16]; FileNameLabel.textColor = [UIColor blackColor]; [cell.contentView addSubview: FileNameLabel]; [FileNameLabel release]; } if(!FileNameLabel) FileNameLabel = [cell.contentView viewWithTag:1001]; FileNameLabel.text =[FileCompletedArray objectAtIndex:indexPath.row]; return cell; } </code></pre> <p>Alternatively you can use the default <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewCell_Class/Reference/Reference.html" rel="nofollow"><code>textLabel</code></a> instead of creating and adding new label</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CellIdentifier"; UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:CellIdentifier]; UILabel *FileNameLabel=nil; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:16]; cell.textLabel.font = [UIFont boldSystemFontOfSize:16]; cell.textLabel.textColor = [UIColor blackColor]; } cell.textLabel.text =[FileCompletedArray objectAtIndex:indexPath.row]; return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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