2017-11-07 6 views
0

にオリエンテーションフォーム決してヒットしません。シミュレータまたはデバイスで回転すると、ブレークポイントにヒットしません。私はまた、デバイスオリエンテーションをinfo.plistでポートレートのみに設定しましたが、アプリはまだ回転します。Xamarinは、私は、ユニバーサルXamarinがNavigationPageに包まれた単一のページとアプリケーションフォーム持っているiPadの

オリエンテーションを制御するために必要な設定ポイントがありません。

私はXamarin Forms 2.4.0.38779を使用しています。

最後の目標は、MasterDetail Pageをランドスケープに強制することです。このコードの正確なモードを強制するために

答えて

0

は記事やフォーラムの投稿の多くを読んだ後、私はこれに出くわした:

https://forums.xamarin.com/discussion/79389/how-to-lock-orientation-in-landscape-for-an-ipad-only-app

このSOポストJoeRaco参照によって最後のポスト:

Xcode 7 ERROR ITMS-90474: "Invalid Bundle", can't submit to Apple

'フルスクリーンが必要です'がTrueに設定されていないと、AppDelegateでGetSupportedInterfaceOrientationsが呼び出されませんでした。したがって、次の情報をinfo.plistに追加すると、私の問題は解決しました。

<key>UIRequiresFullScreen</key> 
<true/> 
0

は私のために働いた:

public MainPage() 
    { 
     InitializeComponent(); 
     OnOrientationChanged += OnOrientationChange; 
     OnOrientationChange(this, new OrientationChangedEventArgs(DeviceOrientation.Landscape)); 
    } 


private void OnOrientationChange(object sender, OrientationChangedEventArgs e) 
    { 
     IOrientationService orientationService = DependencyService.Get<IOrientationService>(); 
     DeviceOrientation currentOrientation = orientationService.GetCurrentOrientation(); 
     if (currentOrientation != DeviceOrientation.Landscape) 
     { 
      orientationService.SetCurrentOrientation(DeviceOrientation.Landscape); 
     } 
    } 
0

は、あなたはこれを試してみました。

protected override void OnSizeAllocated(double width, double height) 
     { 
      base.OnSizeAllocated(width, height); 
       if (width != this.width || height != this.height) 
       { 
        this.width = width; 
        this.height = height; 
        if (Width > Height) 
        { 
         //your grid 
        } 
        else 
        { 
         //your grid 
        } 
       }  
     } 
関連する問題