2012-08-27 3 views
0

기기 방향이 작동하지 않는 이유를 알지 못합니다. 프로젝트 속성에서기기 방향

:

enter image description here

내 코드에서 나는이 :

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return ((interfaceOrientation == UIInterfaceOrientationPortrait) || 
    (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || 
    (interfaceOrientation ==UIInterfaceOrientationLandscapeRight)); 
} 

내 아이폰에 프로브 및 변경되지 않습니다.

뭔가가 있습니까? 형 배열의 Supported interface orientation -

사전에

편집 (의 Info.plist)

enter image description here

+0

지원되는 인터페이스 방향 info.plist에 추가 – Rajneesh071

+1

기기에서 방향 잠금을 사용할 수 있습니까? –

+0

아니요, 잠겨 있지 않습니다. xcode에서 iphone 에뮬레이터로도 시도했습니다. – user1256477

답변

0

XCodeinfo.plist 파일을 열고 줄을 추가 감사합니다.

옆에있는 더하기 단추를 누르고 사용하려는 모든 방향을 나열하십시오. iPhoneiPad에 대해 다른 설정을 지정할 수 있습니다.

+2

위 그림과 같이 지원되는 방향을 선택하면이 작업이 자동으로 수행됩니다. –

+0

이 정보로 내 게시물을 편집했습니다. – user1256477

0
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
if((interfaceOrientation == UIInterfaceOrientationPortrait) || 
    (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)|| 
    (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) 
{ 
    return YES; 
} 

return NO; 

} 
+1

의미가 OP의 코드와 동일합니다. –

+1

OK 나의 실수 ... – NightCoder

0

여기서 코드는 shouldAutorotateToInterfaceOrientation:입니다. UIViewController의 각 하위 클래스의 메소드 여야합니다.

shouldAutorotateToInterfaceOrientation:에 로그 문이나 중단 점을 넣어서 작동하는지 확인하십시오. 그것이 호출되지 않으면 다른 곳의 뷰 컨트롤러가 올바른 방향을 결정하고 있습니다.

+0

NSLog로 말한 것을 시도해 보았습니다. 메서드가 호출되었지만 변경되지 않았습니다. – user1256477