简体   繁体   中英

How do I set the height of the preview cells in a UITableView?

When my UITableView is loading/doesn't have any cells in it yet the cells seem to be set to 44pt high. Can I customize this so it's set to a higher amount, perhaps 100pt?

You can do it in IB as well as programtically

In IB Select UITableView and in attribute inspector set the Row Height as per your need. Select UITableViewCell and in Size Inspector set height as per your need.

If you want to do it programtically, do it using heightForRowAtIndexPath and return 100.0;

You try this one:

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

如果尚无要显示的行,则按如下所示设置UITableView的属性.rowHeight:

tableView.rowHeight = 100.0f;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM