开发者

Subview position issue after UIOrientation (rotation) change

I have a viewController and have added a subview in it programatically.

       secondView.autoresizingMask =  UIViewAutoresizingFlexibleWidth;
       [self.view addSubview:secondView];

I guess when the device rotates, my mainViewController knows that orientation changed, but the subview (secondView) inside the mainViewController does not know this, so I change its frame to landscape size in willRotateToInterfaceOrientation.

       secondView.frame = CGRectMake(0, 0, 4开发者_StackOverflow社区80 , 260);

This does not set in the correct position, it's 11 px below the NavigationBar. Why does it start from 11 px below the navigation bar?

The navigation bar shrinks when we move from portrait to landscape mode and its because of this that my subview is 11px below.


You should change size of the main view (self.view I suppose) before. Did you try that?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜