UIViewContentModeScaleAspectFill expands UIView's frame

wayway

Given that I have a UIImage that has some large frame.

I put this UIImage into a UIImageView *myImageView;

I set the content mode of myImageView to UIViewContentModeScaleAspectFill.

I also set the frame of myImageView to (50,50).

However, my UIImage is significantly bigger than this smaller frame, and for some reason, the image always expands myImageView's frame size.

How do I ensure that myImageView's frame stays constant and doesn't change from image to image?

Thank you!

Holly

Is one side of the image matching the desired dimension (50)? If it is, I suspect that your view is still the intended size, but it is not being clipped. Try setting clipsToBounds on your UIImageView to YES.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

UIViewContentModeScaleAspectFill expands UIView's frame

From Dev

Initializing UIView's frame with CGRectZero

From Dev

UIView's frame rendering larger than frame

From Dev

Pausing a UIView's key frame animations

From Dev

Custom cell's UIView frame not updating in cellForRowAtIndexPath

From Dev

How to get frame of UIView Nested in UIView's - ObjectiveC

From Dev

What is the relationship between a UIView's frame origin and its center?

From Dev

iOS: Adding observer to a UIView's frame.origin.y?

From Dev

Changing an Autolayout-constrained UIView's frame at runtime in Swift

From Dev

is there a cleaner way to edit 1 of the 4 CGRect values of a UIView's frame?

From Dev

Can't set frame of a UIView while it's a child of UIScrollView

From Dev

Why UIInterpolatingMotionEffect doesn't change UIView's frame?

From Dev

Why do layer transforms affect a UIView's frame?

From Dev

is there a cleaner way to edit 1 of the 4 CGRect values of a UIView's frame?

From Dev

How/Do I change a custom UIView's frame manually?

From Dev

Why UIInterpolatingMotionEffect doesn't change UIView's frame?

From Dev

How to unit test UIView's frame after applying CGAffineTransform(translationX)

From Dev

UIView animateWithDuration not changing the frame of UIView

From Dev

How do I add a UIview to an imageView while ensuring that the contents of the UIView are inside the it's frame?

From Dev

How do I add a UIview to an imageView while ensuring that the contents of the UIView are inside the it's frame?

From Dev

Setting the frame to a UIView not working

From Dev

Adjust UIView frame on dragging

From Dev

RACObserve bounds or frame of a UIView?

From Dev

AVPlayerLayer not bounds to UIView frame

From Dev

UIView center, frame

From Dev

Change a UIView Frame

From Dev

Setting the frame to a UIView not working

From Dev

RACObserve bounds or frame of a UIView?

From Dev

Adjust UIView frame on dragging

Related Related

  1. 1

    UIViewContentModeScaleAspectFill expands UIView's frame

  2. 2

    Initializing UIView's frame with CGRectZero

  3. 3

    UIView's frame rendering larger than frame

  4. 4

    Pausing a UIView's key frame animations

  5. 5

    Custom cell's UIView frame not updating in cellForRowAtIndexPath

  6. 6

    How to get frame of UIView Nested in UIView's - ObjectiveC

  7. 7

    What is the relationship between a UIView's frame origin and its center?

  8. 8

    iOS: Adding observer to a UIView's frame.origin.y?

  9. 9

    Changing an Autolayout-constrained UIView's frame at runtime in Swift

  10. 10

    is there a cleaner way to edit 1 of the 4 CGRect values of a UIView's frame?

  11. 11

    Can't set frame of a UIView while it's a child of UIScrollView

  12. 12

    Why UIInterpolatingMotionEffect doesn't change UIView's frame?

  13. 13

    Why do layer transforms affect a UIView's frame?

  14. 14

    is there a cleaner way to edit 1 of the 4 CGRect values of a UIView's frame?

  15. 15

    How/Do I change a custom UIView's frame manually?

  16. 16

    Why UIInterpolatingMotionEffect doesn't change UIView's frame?

  17. 17

    How to unit test UIView's frame after applying CGAffineTransform(translationX)

  18. 18

    UIView animateWithDuration not changing the frame of UIView

  19. 19

    How do I add a UIview to an imageView while ensuring that the contents of the UIView are inside the it's frame?

  20. 20

    How do I add a UIview to an imageView while ensuring that the contents of the UIView are inside the it's frame?

  21. 21

    Setting the frame to a UIView not working

  22. 22

    Adjust UIView frame on dragging

  23. 23

    RACObserve bounds or frame of a UIView?

  24. 24

    AVPlayerLayer not bounds to UIView frame

  25. 25

    UIView center, frame

  26. 26

    Change a UIView Frame

  27. 27

    Setting the frame to a UIView not working

  28. 28

    RACObserve bounds or frame of a UIView?

  29. 29

    Adjust UIView frame on dragging

HotTag

Archive