ポートレートモードでは別のUIViewControllerを表示し、ランドスケープモードでは別のUIViewControllerを表示するUIViewControllerを備えたアプリケーションを作成しました。
風景に行くときは、物を描いたり配置したりするので、風景の座標を取得する必要があります。以下は、iPhoneが回転したときに新しいビューをトリガーするコードです。以下のコードは、このビューがロードされる方法です。
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)x
duration:(NSTimeInterval)duration
{
if (UIInterfaceOrientationIsPortrait(x))
{
NSLog(@"Going Portrait");
} else if (UIInterfaceOrientationIsLandscape(x))
{
NSLog(@"Going Landscape");
if (activeView != [graphViewController view])
{
[containerView addSubview:[graphViewController view]];
}
}
}
私の問題は、
-(void)loadView {
CGRect screenBounds = [[UIScreen mainScreen] bounds];
NSLog(@"GraphViewController: Screenbounds %@", NSStringFromCGRect(screenBounds));
}
GraphViewControllerが返すと、次のように生成されます 。GraphViewController:Screenbounds {{0、0}、{320、480}}
これは風景の共演ではないので、私の絵は正しくありません。[UIScreenmainScreen]境界]を呼び出すときにGraphViewControllerが正しい座標を持つようにするにはどうすればよいですか。?
どうもありがとう
マイク