开发者

UIView and -setBounds issue

I'm using a UINavigationController to manage my UIViewControllers hierarchy. For one of these UIViewController, i need to change its view bounds programmatically (depending on specific conditions) so i used setBounds and it's working fine.

My issue is this : when i change this view bounds, then push another UIViewController to the UINavigationController stack and then pop the last UIViewController, my bounds changement are lost. I guess it's because my UIView is redrawn but i thought the bounds modification would still be live.

I can change my UIView bounds again after the view appeared but the user will notice the view bounds modification.

Any tips? Is it a common situation or is it because my UIView is loaded from a XIB and i missed a parameter or 开发者_运维技巧something?

Thanks :)

Edit : just noticed my UIView bounds are changed right before pushing the new UIViewController to the stack (during the animation)


You probably want to do all of your bounds-setting (including the first time) in -viewWillAppear:. This should get called before you're put on screen in both the initial push and the pop case.


Your view probable has autoresizing set. If you don't want that, set autoresizing to 0:

myView.autoresizingMask = 0;


Where are you changing the bounds? Maybe you should put it in something like viewWillAppear/didAppear so that the bounds are altered everytime the next View Controller is popped off of the stack?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜