2016-05-30 9 views
3

​​3210に強制肖像画のアプリを持っていますが、アプリ内の特定のビューをランドスケープとして表示します。これを達成する最良の方法は何でしょうか? Ionic Framework内に既にオプションがありますか?Ionic Frameworkを使用して特定のビューをランドスケープにするにはどうすればいいですか

CSSを介してページコンテナの要素を90度回転させるようにビューコントローラを設定しようとしましたが、OSがデバイスを回転させてステータスバー/ OSのナビゲーション項目を獲得した回転しないでください。

Ionic Frameworkを使用しているときに特定のビューを特定の向きに強制する方法はありますか?

+0

良い質問です。しかし、私が知る限り、それはIonicフレームワークでは不可能ですが、誰かが解決策を知っていれば私を修正してください。 – Nikola

答えて

3

シムズthisのようなプラグインです。 風景の場合、screen.lockOrientation( 'landscape');を使用する必要があります。コントローラ内。 また、他のページで縦長表示でない場合は、screen.lockOrientation( 'portrait')を置く必要があります。

0

イオン性2.xイオン性ネイティブプラグインが使用できる。

import { ScreenOrientation } from '@ionic-native/screen-orientation'; 

constructor(private screenOrientation: ScreenOrientation) { } 

... 


// get current 
console.log(this.screenOrientation.type); // logs the current orientation, example: 'landscape' 

// set to landscape 
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE); 

// allow user rotate 
this.screenOrientation.unlock(); 

// detect orientation changes 
this.screenOrientation.onChange().subscribe(
    () => { 
     console.log("Orientation Changed"); 
    } 
); 

hereを参照してください。

関連する問題