Henning Schulz
Henning Schulz

Reputation: 627

MonoTouch: UITableViewCell change height after UIImageView is added

Hi I have the following problem:

I achieved to add a CustomUIImageView to a a CustomTableViewCell.

In the draw method of the CustomUIImageView I shrink it to the width of the incoming rect which is the cells width.

But now the cell height is way higher than the resized image. And the GetHeight method of the TableView is already called.

How can I achieve that the new image height is used as the cell height?

Thank you!

Resized image is way smaller than the cell

Upvotes: 1

Views: 211

Answers (1)

jonathanpeppers
jonathanpeppers

Reputation: 26495

The best way to achieve this is to reload the specific row in your tableView:

tableView.ReloadRows(new NSIndexPath[] { NSIndexPath.FromRowSection(0, 0) }, UITableViewRowAnimation.Fade);

I normally do this kind of thing if I'm downloading images from the web, etc.

Let me know if this solves you issue, post some of your code and I can get more specific.

Upvotes: 2

Related Questions