For an UIImageView, different mode options are given In the interface builder like Aspect Fit, Aspect Fill. Can anyone tell me what is the difference b/w these two modes: Scale to Fill VS Redraw?
Difference b/w Redraw and Scale to Fill Mode in UIImageView?
Asked Answered
UIViewContentModeScaleToFill
For the first time, drawRect:
is called and view is rendered. Later, when geometry changes, drawRect:
is not called and already rendered content is scaled to draw the view.
UIViewContentModeRedraw
Every time you change bounds, drawRect:
is called to render the view again, again and again. Unless you know what are you really doing and unless you really need it, don't use it. It's much slower, because it must call drawRect:
again and again. In other words, when you set UIViewContentModeRedraw
it's same behavior as when you call setNeedsDisplay
every time bounds are changed.
Simplified explanation, but should clarify it a bit for you.
© 2022 - 2024 — McMap. All rights reserved.