nabiullinas
nabiullinas

Reputation: 1245

Can not change cell size in UITableView

I create tableViewController and need to make the last cell bigger. But I can't to set the size as I want. Here My code

cell.bounds = CGRectMake(0,45,320,900);
        [[cell.contentView viewWithTag:indexPath.row]removeFromSuperview] ;
        CGRect frame = CGRectMake(20, 20, 400, 500);
        CGRect frame2 = CGRectMake(0, 0, 400, 500);
        [cell setFrame:frame];
        [cell setBounds:frame2];

        //[self tableView].rowHeight = 500;
        UITextView *txtView = [[UITextView alloc] initWithFrame:frame];
        txtView.text = @"SEND FROM MY IPAD";
        txtView.textAlignment = UITextAlignmentLeft;
        [cell.contentView addSubview:txtView];
        [txtView release];

But I can change height for some pixels and all(enter image description here

Upvotes: 0

Views: 770

Answers (1)

beryllium
beryllium

Reputation: 29767

You need to implement UITableViewDelegate Protocol in order to change row (cell) height. See method tableView:heightForRowAtIndexPath:.

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

To change width just set UITableView's width to required value.

Upvotes: 1

Related Questions