Re: UIImageView Scaling
Steve Christensen <punster@...>
I'm glad it worked for you.toggle quoted message Show quoted text
One thing I noticed in your bug report is your mention of the *addition* of setNeedsLayout() to the existing sizeToFit(). I believe in the auto layout world that sizeToFit() isn't actually doing anything useful since it's manipulating the view frame directly, so just calling setNeedsLayout() alone should do the trick.
The layout pass that occurs automatically in two of your cases, or the one triggered explicitly by calling setNeedsLayout(), is causing the layout engine to calculate the new bounds based on the contraints, not on the image's actual size. You can see that in how the imageview size changes in viewDidLayoutSubviews() for cases 1 and 3.
On Jul 30, 2018, at 9:24 AM, Rick Aurbach via Groups.Io <rlaurb@...> wrote:Steve,I know I’ve tried various things to force a re-layout, but obviously not that.Your solution worked in my app beautifully. Thank you so much for the suggestion.I will follow up by filing a radar about the problem. I’ll suggest that they either fix the (presumed timing) bug or address the issue in documentation.Thanks again.Cheers,Rick Aurbach