Programming/iOS
아이폰 가로모드 & 세로모드
알레아
2011. 11. 15. 17:13
반응형
화면회전과 관련된 함수는 UIInterfaceOrientation이고 UIViewController에 상속되어 있다.
호출되는 함수
현재 디바이스의 모드가 어떤건지 확인 하는 함수
호출되는 함수
// Override to allow rotation. Default returns YES only for UIInterfaceOrientationPortrait
- shouldAutorotateToInterfaceOrientation
// Notifies when rotation begins, reaches halfway point and ends.
- willRotateToInterfaceOrientation
- didRotateFromInterfaceOrientation
- shouldAutorotateToInterfaceOrientation
// Notifies when rotation begins, reaches halfway point and ends.
- willRotateToInterfaceOrientation
- didRotateFromInterfaceOrientation
현재 디바이스의 모드가 어떤건지 확인 하는 함수
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
if(UIDeviceOrientationIsPortrait(orientation))
{
//새로모드
}
else if(UIDeviceOrientationIsLandscape(orientation))
{
//가로모드
}
반응형