2016-04-11 22 views
1

iOs のデバイス(iPhone 4およびiPad 4世代でテスト済み)で自分のイオンアプリケーションを実行する際に問題があります。すべては、アンドロイド携帯電話、タブレットとアイオスのエミュレータで完璧に動作しています。iOsの向きと高さがそれより小さい

(これは私が使用していますオリエンテーションプラグインです:コルドバ・プラグイン画面の向きを)

マイアプリはポートレートモードでは、私は横向きをロックし、別のページに渡すボタンをクリックしてロックされています。 (すべてがうまくいきます) バックボタンをクリックしてポートレートページに戻ると、ポートレートモードになりますが、ウィンドウの幅と高さが完全に狂ってしまいます。

私は他のトピックで見つかった多くの構成を試してみましたが、それらのどれも私のために働いていない:

<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> 
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" /> <!-- Works on android --> 
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi, user-scalable=no" /> 
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 

は、私はまた、肖像ページのinital幅と高さがあることに気づい:

[Log] Window height = 480 width = 320 

ランドスケープページより:

[Log 2] Window height = 320 width = 480 

最後に、私がportrに戻ると

[Log 3] Window height = 640 width = 160 

これらのログ

は、これらの2つの方法で同じです::AITページ私はこれを持って

window.innerHeight/document.documentElement.clientHeight 
window.innerWidth/document.documentElement.clientWidth 

ここにこのトピックでは、関連するがunasweredされていますstackoverflow.com/questions/18835784/iphones-orientation-変更・バック・ツー・肖像ブレーク-サイト-ズーム

ページのスクリーンショット:

Page 1 in portrait mode

Page 1 in portrait mode but with width problems

ありがとうございます!

答えて

2

私はついにこの問題を解決することができました。ここに私の修正です:

XCodeでiOsプロジェクトを開きます。ビルドと楽しむMainViewController.m

- (void)webViewDidFinishLoad:(UIWebView*)theWebView 
    { 
    // Black base color for background matches the native apps 
    theWebView.backgroundColor = [UIColor blackColor]; 
    theWebView.scalesPageToFit = true; 
    theWebView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 

    return [super webViewDidFinishLoad:theWebView]; 
    } 

に次の関数を編集ザン

関連する問題