Reputation: 1500
I've a UITableView with dynamic cells. My custom cell is composed by an imageView that meant to represent a comics. On this comics I've a textView that retrieve some text from my db. I want to change the height of my cell and the height of my comics proportionally to the text. I state that the comics image is composed by three images, the top of comics, the bottom of comics and the center of comics. The center is a rectangle that has to be repeated itself many times depending on the length of the text. The size of the textView must vary according to the length of the text.
Please help me
Upvotes: 0
Views: 307
Reputation: 4097
To get an estimate of the size for a text in iOS 7, use the following method:
- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes context:(NSStringDrawingContext *)context
Then in
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
Take the returned CGRect and return the height.
Upvotes: 1