iPhone/iPad UIScrollView subview orientation and setAutoresizeMask problem
I have a UIViewController that is being pushed via a UINavigationViewController.
The viewController's view has a UIScrollView as a subview. I'm initializing the UIScrollView with the same bounds as the viewController's view bounds and set the auto resize mask to flexible height/width so it will still occupy all the screen. This works well when the view controller is pushed in开发者_如何转开发 portrait mode (the orientation changes works great), but if I push it in landscape mode, the scroll view isn't occupying all the height, but rather it looks like it scaled weird.
Now if I remove the autosize mask the scroll view is in fact covering the whole view when entering both in portrait and in landscape mode, but then the autoresizing doesn't work. (obviously)
Is there a way to solve my problem using the autosize mask? or should I stop using it, and implement willRotateToInterfaceOrientation?
To solve my problem I added
[self.view setFrame:[[[self navigationController] view] bounds]];
after the [super loadView] call and before the rest of the addSubViews
精彩评论