Frame shifted incorrectly with Autoresizing in iOS7

252 Views Asked by At

I'm having an issue with a view using autosizing resizing improperly in iOS7 (but fine in 6). The view initially renders as I'd expect, then I push another view onto the stack. Once I pop back to the original view, a subview that should be anchored on the right sizes itself too large and of the bounds of the superview.

It's a fairly simple view, created in a Storyboard, that includes the following hierarchy:

Scrollview -> View ->ImageView

It uses autosizing masks, which frankly was done because I had issues using autolayout inside the scrollview in this case (don't want to get into that here). The mask for the ImageView is pretty simple:

    -
    |
    _
|-|<->|-|
    -
    |
    -

On initial load, the X coord and width are as follows:

UIScrollView: frame = (0 64; 320 455); clipsToBounds = YES; autoresize = W+H;

UIView: frame = (0 0; 320 568); autoresize = W+BM

UIImageView: frame = (20 110; 280 50); clipsToBounds = YES; opaque = NO; autoresize = W;

On subsequent load, it appears as follows

UIScrollView: frame = (0 64; 320 455); clipsToBounds = YES; autoresize = W+H

UIView: frame = (0 0; 320 568); autoresize = W+BM

UIImageView: frame = (20 160; 320 50); clipsToBounds = YES; opaque = NO; autoresize = W

The notable difference being, as bolded, the width of the ImageView frame increases to 320, which is the size of it's bounds. Since it is still offset by 20, it ends up running off the screen. Obviously, I would expect it to stay at 280, as it does when this same thing is run in iOS6.

I don't manipulate the view in any way in code, so this should all be tied the autolayout masks. I cannot find anything about others having similar issues.

--

0

There are 0 best solutions below