Skip to content

Instantly share code, notes, and snippets.

@keicoder
Created January 2, 2014 10:59
Show Gist options
  • Select an option

  • Save keicoder/8217642 to your computer and use it in GitHub Desktop.

Select an option

Save keicoder/8217642 to your computer and use it in GitHub Desktop.
objective-c : 아이폰과 아이패드의 인터페이스 오리엔테이션
아이폰과 아이패드의 인터페이스 오리엔테이션
1. XCode -> View based application 생성
2. ViewController -> UIImageView 삽입
3. Resources 그룹에 임의의 이미지 삽입. 이 이미지를 UIImageView의 디폴트 이미지가 되도록 수정.
4. ViewController.m 파일의 shouldAutorotateToInterfaceOrientation: 메소드를 다음과 같이 수정.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
switch (interfaceOrientation) {
case UIInterfaceOrientationPortrait:
NSLog(@"Interface 방향 : Portrait");
break;
case UIInterfaceOrientationPortraitUpsideDown:
NSLog(@"Interface 방향 : Portrait UpsideDown");
break;
case UIInterfaceOrientationLandscapeLeft:
NSLog(@"Interface 방향 : Landscape Left");
break;
case UIInterfaceOrientationLandscapeRight:
NSLog(@"Interface 방향 : Landscape Right");
break;
default:
break;
}
return YES;
}
5. Shift + Command + R로 콘솔창을 열고 실행.
6. Shift + ->(화살표), Shift + <-(화살표)를 이용 이동시키고, NSLog 값을 콘솔에서 확인.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment