简体   繁体   中英

How to resize the UITableViewCell based on size of image to be inserted?

In my tableview, I have one section, and in that section there are two rows.
The first row contains the name of an image and the second row contains the actual image. When inserting the image, I want to resize the cell based on size of that image. I tried out with cell frame and size, but it's not working.

What can I do to solve this problem?

The cells are laid out by the UITableView , you can't resize the cells directly.

You have to implement - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath in your UITableViewDelegate

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