2012-05-24 4 views
1

내보기는 원래 가로 모드입니다. 단추가 녹화되면보기가 세로 모드로 열리고 모든 것이이 지점까지 있습니다. 문제는 내가 그보기에서 루트보기로 돌아갈 때보기가 올바르게 회전하지 않을 때입니다. 여기에 내가 세로에서 가로로보기를 회전하는 데 사용하는 코드, 여기iPad가 세로에서 가로로 회전합니다.

-(void)viewWillDisappear:(BOOL)animated 
{ 
[super viewWillDisappear:animated]; 

//rotate the page to lansscape 
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(-90*0.0174532925); 
landscapeTransform = CGAffineTransformTranslate (landscapeTransform, 0.0, 0.0); 

[self.navigationController.view setTransform:landscapeTransform]; 

self.navigationController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;  
self.navigationController.view.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height); 
self.navigationController.view.center = CGPointMake (384.0, 544.0); 

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft; 
} 

는 세로 페이지에서 돌아온 후 가로 모드에서 루트 페이지의 스크린 샷이다

enter image description here

이것은

enter image description here

+0

xib 방향을 확인하십시오. – Santhosh

+0

물론 풍경입니다! – Mona

답변

1
-(void)viewWillDisappear:(BOOL)animated 
{ 

[super viewWillDisappear:animated]; 

//rotate the page to lansscape 
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(-90*0.0174532925); 
landscapeTransform = CGAffineTransformTranslate (landscapeTransform, 0.0, 0.0); 

[self.navigationController.view setTransform:landscapeTransform]; 

self.navigationController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;  
self.navigationController.view.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height+64); 
self.navigationController.view.center = CGPointMake (384.0, 512.0); 

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft; 

} 
같이하는 방법입니다

난 세로 모드에이 뷰가이 있었다 사라지면 나타나는 된 가로보기를 조정 놀러했던 것은, 내가 중심점과 조정 프레임 높이 약 연주

self.navigationController.view.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height+64); 
self.navigationController.view.center = CGPointMake (384.0, 512.0); 

그것.

관련 문제