MissCoder87
MissCoder87

Reputation: 2669

UITableCell Custom Cell not taking height of custom cell

A follow on to my last question UITableViewCell custom cell using IB loading data probably best to start a new one for a new question!

My Custom cell is loading (designed in IB)

Here is my xib file for the custom cell:

enter image description here

And heres how it loads in my table:

enter image description here

So it's not loading the size properties for the custom cell (but it's loading the text to the right labels and it's loading the blue arrow on the right from the nib)

Heres how the code is populating the table:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    ViewRoutesCell * aCell = (ViewRoutesCell *)[tableView dequeueReusableCellWithIdentifier:@"ViewRoutesCell"];

    if (aCell == nil)
    {


        NSArray *arr = [[NSBundle mainBundle] loadNibNamed:@"ViewRoutesCell" owner:self options:nil];

        for (NSObject *anObj in arr) {

            if([anObj isKindOfClass:[ViewRoutesCell class]]) {
                aCell = (ViewRoutesCell *)anObj;
                aCell.lblRouteText.text = [arryRouteText objectAtIndex:indexPath.row];
                aCell.lblRouteImage.text = [arryRouteImage objectAtIndex:indexPath.row];
            }



        }
}

    return aCell;
}

What am I doing wrong loading the cell?

Tom

Upvotes: 0

Views: 766

Answers (1)

Kjuly
Kjuly

Reputation: 35141

tableView:heightForRowAtIndexPath: You may need this method(UITableView's delegate method).
Just return the height you want. Or judge for different type of cell by indexPath.

Upvotes: 3

Related Questions