Using drawRect stretches during orientation change

I have a tableView. Instead of having multiple subviews in each tableViewCell, I added one main subquery that draws each of the other subzones in the drawRect method. (I read somewhere that this improves the scrolling animation. Apple also has a sample CustomTableViewCell project).

First, the problem is when I change the orientation of the device and then drawRect is not automatically called. And each tableviewcell seems to be stretched out. I solved this by using

mainView.contentMode = UIViewContentModeRedraw


This solves the problem. Now that the orientation change is done, drawRect is called automatically.

But during the orientation change, the animation of the rotating view still shows that every cell of the tableview is stretched. This is very small, but it is still noticeable. Can anyone suggest something on this ?????


source to share

1 answer

You cannot redraw while animating (not that easy).

Reconnect the table cell to the components and set up the correct auto-implementation. Then the animation will only animate the positions of the components and it will look fine.

Where did you read drawRect:

, is it better to make a scroll animation? Have you had trouble scrolling your animation?

Edit: IMHO There is no way to fix the resize animation and increase performance from using drawRect:

subviews instead.



All Articles