user2687634
user2687634

Reputation:

I'm having trouble resizing a table view cell

I am trying to create a sample app to resize a cell. The cell is staying at the default height of 44px. I am unable to make this change through the storyboard because I have a view with varying height inside the cell. Can this be done with only 1 cell? I have an outlet from the table cell to the variable called cell. My code in the .m file is as follows. Also, all the cells are already static.

    self.whereCell.frame = CGRectMake(0, 191, 320, 78);

Upvotes: 0

Views: 33

Answers (1)

Joseph Duffy
Joseph Duffy

Reputation: 4826

Have you tried the tableView:heightForRowAtIndexPath: method?

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        return 191;
    }

    return 44;
}

This shouldn't been needed if the cell is static though; you should be able to set the height of the cell in Interface Builder.

Upvotes: 1

Related Questions