I am facing a problem I really do not understand.
I have a view (grey rectangle) and a subview (red rectangle). The architecture is UIViewController => View(grey rectangle) => UIImageView (red rectangle).
I want the red rectangle to resize when the grey rectangle bounds change.
So I put the property "Autoresize subviews" to Yes for the grey rectangle and add the following code :
_image.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight ;
But when I resize the grey rectangle, nothing happens for the red one : the grey one is bigger and the red one keeps the same frame.
Do you have any idea to help me ?
Update :
I added the imageView in the storyboard as subview of the "grey rectangle". I tried to add another UIImageView by code and that works.
So my new question is do you know why autoresizing is not working with subviews edited in storyboard ?
[view addSubview: UIImageView]
Did you do that? or added imageview to mainView? – Mani_image
isnil
or you have conflicting parameters between IB and your code. Or AutoLayout is enabled by default on IB so frames doesn't work. – Tancrede Chazallet