0

Setting cornerRadius and masksToBounds will lead to offscreen rendering, so that it will affect the performance when scrolling the table. Though this has been mentioned a lot before, does anyone ever make an experiment about this in iOS 9?

Here is my demo, It seems that setting cornerRadius doesn't have any influence on scrolling performance. On my iPhone 6, the average fps is still 57 or 58.

Does iOS 9 make any optimization or I did something incorrectly?

By the way, I noticed that when the UIImageView is a square(width = height), setting conner of some UIImageView will not lead to offscreen rendering. How does this happen?

sevenkplus
  • 178
  • 1
  • 12

2 Answers2

0

You have misunderstood what the warning about cornerRadius and masksToBounds is about. You are merely setting the cornerRadius and masksToBounds of some image views inside your cell. Those image views are not what is being animated when the table view is scrolled: it is the cells that are animated. The interior of the cell is already completely composited; it does not have to be recomposited on every frame of the animation.

If you had set the cornerRadius and masksToBounds of every cell, you might see some more severe effect on scrolling.

matt
  • 515,959
  • 87
  • 875
  • 1,141
0

It seems that I didn't add enough images to the cell. When the number of presenting images reaches 30 or more, the influence on performance becomes apparent. The average fps drops down to 33.

sevenkplus
  • 178
  • 1
  • 12