0
親ビューコントローラがあります。 私は子供のviewcontrollerを持っています。 子ビューコントローラが終了すると、親ビューコントローラは横長状態のままです。してくださいアドバイス:=) これらの設定は、次のとおりです。 deployment info親ビューコントローラの回転を回避する方法
マイアプリデリゲート
-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
UIViewController* topVC = [self getTopController];
if ([topVC isKindOfClass: [childVideoViewController class]]) {
return UIInterfaceOrientationMaskLandscape;
}
return UIInterfaceOrientationMaskPortrait;
}
-(UIViewController*) getTopController{ UIViewController *topViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topViewController.presentedViewController) {
topViewController = topViewController.presentedViewController;
}
return topViewController;
}
私のchildviewcontrollerがdelegate.setscreenorientation(肖像画)を呼び出した後、私の親viewcontrollerはまだランドスケープにあります。あなたの努力のために@ MasumBiswas-私の親viewcontrollerはまだ横たわっています。私は何が欠けていますか? – TheSnakeWizard
それは私のために働いています。関数を呼び出さずに直接行ってください。 –
子ビューコントローラを回転するために、アプリケーションデリゲート内に実装する必要はありません。あなたはviewdidloadのように以下のようにすることができます:[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@ "orientation"]; –