Custom UITableViewCell built using IB size?

I guaranteed that the autosave mask of my cell allows a flexible width, but when the device rotates, the cells do not change.

I also checked the resizing of the table, the problem is directly related to the cells.

This is the code I use to create cells:

if (cell == nil) {
        // Load the top-level objects from the custom cell XIB.
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"MetaTableViewCell" owner:self options:nil];
        // Grab a pointer to the first object (presumably the custom cell, as that all the XIB should contain).
        cell = [topLevelObjects objectAtIndex:0];
    }

Can anyone think what might be wrong?

Are cells created using IB never change?

+3
source share
2 answers

If its cell height does not change, I suggest you change the delegate method UITableViewafter rotation.

-

(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if(condition)// has rotation taken place
    // new height
    else
    // old height
    }

Pls make sure you call [tableView reloadData];when a turn occurs.

+1
source

, UITableViewCells, ? TableView:

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return *height*;
}

. IB, , - . , .

0

All Articles