Subview position issue after UIOrientation (rotation) change
- by asadqamber
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.