Hello,
I faced a strange problem. My task is to provide scaling an image to fill the UIImageView frame. The UIImageView is a subview of another view.
The code is following:
CGRect frame=CGRectMake(0,0,viewSize.width,viewSize.height);
UIView* backView=[[UIView alloc] initWithFrame:frame];
backView.autoresizesSubviews=YES;
backView.autoresizingMask=UIViewAutoresizingFlexibleWidth;
UIImageView* imgView=[[UIImageView alloc]initWithFrame:viewFrame];
imgView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
imgView.contentMode=UIViewContentModeScaleToFill;
[subcellBackView addSubview:imgView];
[imgView release];
When the image arrives, it is assigned to imgView:
imgView.image=img;
The image is scaled according to the imgView's size. Everything is all right until the iPhone (simulator) is rotated. After first autoresizing the imgView size becomes equal to the image size (which is much greater) and overlaps its superview frame. The superview frame reacts to the orientation change properly.
Could you please help?