2011-01-03 11 views
3

次のコードを使用してポートレートビューを横長ビューに変更しても問題ありません。setStatusBarOrientation:デバイスの向きを変更する方法

しかし、私が知る必要があるのは、風景を風景に変更した後、デバイスの現在の向きを印刷して、「ポートレート」モードにすることです。

このコードはデバイスの向きを変更できますか?もしそうなら、なぜ私は現在の方向をチェックするときに "ポートレート"モードとして表示されますか?

どうすればドキュメントの向きを変更できますか?

親切に私を助けて...デバイスの向きが変化していなかったので

[[UIApplication sharedApplication] setStatusBarOrientation: 
UIInterfaceOrientationLandscapeRight]; 

UIScreen *screen = [UIScreen mainScreen]; 
CGFloat screenWidth = screen.bounds.size.width; 
CGFloat screenHeight = screen.bounds.size.height; 
UIView *navView = [[self navigationController] view]; 
navView.bounds = CGRectMake(0, 0, screenHeight, screenWidth); 
navView.transform = CGAffineTransformIdentity; 
navView.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); 
navView.center = CGPointMake(screenWidth/2.0, screenHeight/2.0); 
[UIView commitAnimations]; 

答えて

0

以下の私のコードを見てください! statusBarの向きを手動で設定し、ビューにトランスフォームを適用するだけです。

+0

したがって、ドキュメントの向きを変更するにはどうすればよいですか? – user198725878

+0

短答:デバイスを回転することで、それはすべてです;-) – VdesmedT

関連する問題