Difference b/w Redraw and Scale to Fill Mode in UIImageView?
Asked Answered
U

1

7

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?

Utilitarianism answered 30/8, 2012 at 11:36 Comment(0)
E
24

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.

Eyot answered 30/8, 2012 at 11:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.