0
Apple은 iPad 용 Photo 's를 시연했습니다. 데모에서는 iPad를 뒤집어서 이미지를 뒤집을 수 있다고했습니다.가로 모드 : iPad를 뒤집을 때 이미지 뒤집기
이 결과는 어떻게 달성됩니까?
는 하루 종일 UIInterfaceOrientation에 대해 읽어 봤는데 내가 어떤 도움을 주시면 감사하겠습니다
잃었어요.
- (BOOL)shouldAutorotateToDeviceOrientation:... {
Return YES;
}
을 그리고 UIKit 당신을 위해 모든 것을 관리하는 대부분의 시간 :
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
// NSLog(@"orientation: %@", [orientation)
if(orientation==UIInterfaceOrientationPortrait ||orientation==UIInterfaceOrientationPortraitUpsideDown) {
//Code
return NO;
}
if (orientation==UIInterfaceOrientationLandscapeRight ||orientation==UIInterfaceOrientationLandscapeLeft) {
//Code
return YES;
}
return NO;
}
감사하지만 어떻게 뒤집혔는지 어떻게 알 수 있습니까? - (BOOL) shouldAutorotateToInterfaceOrientation : (UIInterfaceOrientation) interfaceOrientation { \t UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]; // \t \t NSLog (@ "방향 %의 @", [배향) 경우 (배향 방향 == UIInterfaceOrientationPortrait || == UIInterfaceOrientationPortraitUpsideDown) {// \t \t \t \t 코드 복귀 NO; \t} \t (오리엔테이션 == UIInterfaceOrientationLandscapeRight || 방향을 == UIInterfaceOrientationLandscapeLeft) { \t \t // 코드 \t \t 반환 YES 경우; \t} \t return NO; } –
나는 그것을 테스트했지만 뒤집기를 수행하지는 않습니다. 나는 뒤집을 때조차 확신이 없다. –
(대개의 경우)보기가 뒤집 혔을 때 상관 없어도 장치가 회전을 처리합니다. 컨트롤러가 tab/nave 컨트롤러 내에 있다면, 모든 뷰 컨트롤러가이 메서드에서 true를 반환하는지 확인해야합니다. –