2014-01-27 2 views
0

사용자가 다른보기로 이동하고 사용자가 클릭 한 단추와 방향에 따라 새보기를 배치하는 탐색 컨트롤러가 있습니다. 나는 layout라는 방법을하고 난 viewDidLoad, viewWillAppear에서이 메소드를 호출하고, willAnimateRotationToInterfaceOrientation처음로드시 가로가 인식되지 않음

그러나, 뷰가 처음로드 될 때, 응용 프로그램은 풍경에있어 인식하지 못합니다. 나는 심지어 if 문에 중단 점을 넣어 시도했습니다

UILabel *shareLabel = [[UILabel alloc] initWithFrame:CGRectMake(488, 90, 179, 30)]; 
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) { 
    shareLabel.frame = CGRectMake(543, 90, 238, 30); 
} 

하고는 if 문에 도달 할 때, 그것이 것을 인식 아니에요 저를 알려줍니다, 그 위에 단계 : 내가 가진 코드는 경치? 왜 이것이 될지에 대한 아이디어가 있습니까?

+0

확인이 ** HTTP : //stackoverflow.com/questions/2614274/determine-uiinterfaceorientation-on-ipad** –

답변

0

확인이 밖으로

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 

if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait) ) 
{ 
// do something for Portrait mode 
} 
else if(([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight) ||   ([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft)) 
{ 
// do something for Landscape mode 
} 
관련 문제