I have a UIVIew
that contains an UIImageView
. I want to make the UIView
same size and same coordinate with the UIImageView
. How can I do it?
To auto resize programatically.
At first Uncheck the autoLayout here is the screen shot.
The add the code for auto resize
>
myView.autoresizingMask=UIViewAutoresizingFlexibleWidth;
myView.autoresizingMask=UIViewAutoresizingFlexibleHeight;
Try this
//myview : UIView
//imageview:UIImageview
CGRect frame1=myview.frame;
CGRect frame2=imageView.frame;
CGRect frame3=CGRectMake(frame1.origin.x+frame2.origin.x, frame1.origin.y+frame2.origin.y, frame2.size.width, frame2.size.height);
[myview setFrame:frame3];
[imageView setFrame:myView.bounds];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.