In my app I have a tableview, with a custom tableviewcell and that has a UIImageView in it.
However, my issue. - (void)configureCell:(MyCustomCell *)cell atIndexPath:(NSIndexPath *)indexPathwhere I set the frame of my image is called before - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath where I set the cell height.
Meaning, the image position isn’t correct (its dynamic, changes depending on cell height).
How do you suggest I get around this?
Thanks.
When do you call your
configureCell:atIndexPath:method? In yourtableView:cellForRowAtIndexPath:implementation?Anyway, try to set you image height in
tableView:willDisplayCell:delegate method instead. This method is called just bore the cell is displayed on screen so that it will not be resized afterwards by other internal methods.Besides, can’t you use the AutoresizingMask property to make your image view resize automatically depending on its container view (the cell)?