UIView Frame Size Didn't Change UIImageView Placed inside it

北战南征 提交于 2019-12-06 07:25:13

You can also Try This :-

imageView.frame = CGRectMake(0,0,imageObject.frame.size.width, imageObject.frame.size.height);
imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.imageShw.contentMode = UIViewContentModeScaleAspectFit;
christijk

First You can try,

self.imageObject.autoresizesSubviews = YES;

Otherwise to get the subviews to resize, you can add autoresizing mask to the subviews, to the two imageviews in your case:

imageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin   |
                             UIViewAutoresizingFlexibleRightMargin  |
                             UIViewAutoresizingFlexibleTopMargin    |
                             UIViewAutoresizingFlexibleBottomMargin |
                             UIViewAutoresizingFlexibleWidth        |
                             UIViewAutoresizingFlexibleHeight;

Check UIView documentation for more details.

Avi Tsadok

Try:

imageView.frame = CGRectMake(0,
                             0,
                             imageObject.frame.size.width, 
                             imageObject.frame.size.height);
imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | 
                             UIViewAutoresizingFlexibleWidth;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!