Re: UIImageView Scaling


Steve Christensen <punster@...>
 

I think I ran into similar issues in the dim past. If I recall correctly, the image view would resize to accommodate the image size if the image was set before a layout pass, or maintain some fixed size (initial frame?) if the image was set later. And I believe this was happening when there were no explicit constraints. 

I didn’t ask before, but do you have constraints, either fixed or proportional to something else, set on the image view? If so, and the image view is set to aspect fit, then you should get consistent behavior no matter the image size. 

Steve


On Jul 20, 2018, at 10:07 PM, Rick Aurbach via Groups.Io <rlaurb@...> wrote:

1. For any image which has an intrinsic size larger than the destination UIImageView object, the sizing behavior is the same. Namely, when the picker is dismissed (calling loadData(), the upper left corner of the image appears, fully expanded. In all other cases where the image is displayed (such as after switching between scenes, etc.), the image has been scaled to fit the UIImageView's physical size.

2. This is two questions. The images that cause problems have a size (i.e. UIImage::size) larger than the physical dimensions of the device. And in both the "correct" and "incorrect" cases, the UIImageView:bounds rectangle has a size equal to the image's size.

Rick

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.