开发者

Resizing UIView with UIScrollView subview

I have a big problem concerning the resizing of a derived UIView with a UIScrollView as subview.

In the layoutSubviews me开发者_Python百科ssage I set the frame of the UIScrollView subview. the UIScrollView contains a UIImageView with a big image which can be moved/pinched and so on. The initial contenSize of the UIScrollView is the initial image size.

So far, so good. Moving and pinching of the image works well. Now I have to change the UIView frame (in my app to maximize the UIView). im doing that in a animation block (beginAnimations/commitAnimations). So I set the new frame (which will update the width & height) an then I call [myView layoutIfNeeded] to force the UIScrollView to update its frame in the layoutSubviews message of my view.

The UIView animates correct to its new frame and if the contentOffset of the UIScrollView is currently x 0, y 0 the UIScrollView frame will be updated properly. but here's my problem: if the contentOffset of the UIScrollView is bigger than x 0, y 0 the UIScrollView will "slide in" from upper left to its final position.

I want that the UIScrollView resizes its frame properly with the parents frame and aligns the content (in my case the UIImageView) right. But how could I achieve that?


after hours of web research i found the solution for this problem:

[UIView setAnimationBeginsFromCurrentState: YES];

this will animate all layers from the current state.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜