사용자가 iPad를 가로 모드로 잡고있는 경우 키보드의 프레임 오프셋을 결정합니다. 가로 모드에서 콘텐츠를 추가하고 표면에 iPad를 평평하게 놓으면 옵셋을 올바르게 설정할 수 없습니다. 내가 오프셋 설정 아래 코드를 사용하고 있습니다 : 내가 확인할 수 있습니다기기를 표면에 설치 한 후 앱 UI가 가로 방향인지 확인할 수 있습니까?
if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight) {
tableView.frame = CGRectMake(0,0,tableView.frame.size.width, tableView.frame.size.height-keyboardsize.height);
}
UIDeviceOrientations은 다음과 같습니다
typedef enum {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait,
UIDeviceOrientationPortraitUpsideDown,
UIDeviceOrientationLandscapeLeft,
UIDeviceOrientationLandscapeRight,
UIDeviceOrientationFaceUp,
UIDeviceOrientationFaceDown
} UIDeviceOrientation;
어떤 방법으로 나를 위해 거기 사용자가 가로 방향 (UIDeviceOrientationLandscapeLeft
또는 UIDeviceOrientationLandscapeRight
)의 앱을 들고 있는지 확인한 다음 기기를 내려 놓습니다 (UIDeviceOrientationFaceUp
이어야 함).
내 문제를 해결했습니다. – propstm