Subview position issue after UIOrientation (rotation) change

Posted by asadqamber on Stack Overflow See other posts from Stack Overflow or by asadqamber
Published on 2010-06-03T07:44:27Z Indexed on 2010/06/03 7:54 UTC
Read the original article Hit count: 475

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, 480 , 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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about height