これは私のAppDelegateにあり、向きの変更で実行されます。アプリケーションがロードされると、常にポートレートモードとしてロードされます。デバイスがランドスケープモードのときにアプリケーションをロードすると、デバイスがポートレートモードの場合と同じように実行されます。それが私が抱える最初の問題です。2つ目は、ロード後、デバイスを縦向きから横向きに回転させると、以下に示すようにスレッドが中断することです。
-(void)setOrientationView
{
UIDevice *currentDevice = [UIDevice currentDevice];
[currentDevice endGeneratingDeviceOrientationNotifications];
UIDeviceOrientation theOr = currentDevice.orientation;
if ( UIDeviceOrientationIsLandscape(theOr) && !isLandVisible )
{
NSLog(@"setLand");
isLandVisible = YES;
isPortVisible = NO;
[self.window.rootViewController pushViewController:portCont animated:YES]; // <Thread 1: breakpoint 2.1
}
if( UIDeviceOrientationIsPortrait(theOr) && !isPortVisible )
{
NSLog(@"setPort");
isPortVisible = YES;
isLandVisible = NO;
[self.window.rootViewController pushViewController:portCont animated:YES];
}
[currentDevice beginGeneratingDeviceOrientationNotifications];
}
ストーリーボードアプリを使用して、ロード時に両方の方向をサポートしようとして、ビューを表示した後にビューを閉じることなく、髪を引っ張っています(UIWebViewのリロードを防ぐために必要です)。ですから、私を超えた2つの問題があります。ありがとうSO。