UIWebView dones't resize correctly when orientation change?

后端 未结 7 2101
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 14:11

I have add a webview,a titleLabel and a coverflowView on a viewcontroller\'s view as its subviews, I want it to change size when the orientation change. I have change the we

7条回答
  •  盖世英雄少女心
    2020-12-02 14:15

    I upvoted @christophercotton's response since it worked. But I also found I could fix a problem similar to this without controlling the webview object. His solution put me on the right track for my problem.

            var el = $('meta[name=viewport]');
        if (window.orientation == 90 || window.orientation == -90) {
            el.attr('content', 'width=device-height');
        } else {
            el.attr('content', 'width=device-width');
        }
    

    This works in iOS. Have not tried it in android (for those using the likes of PhoneGap).

提交回复
热议问题