Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3413] iOS: WebView doesn't resize correctly in scrollableView on orientation change

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2011-06-03T17:30:58.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-22
ComponentsiOS
Labelsn/a
ReporterRick Blalock
AssigneeBlain Hamon
Created2011-04-15T03:44:00.000+0000
Updated2017-03-24T18:20:32.000+0000

Description

When changing orientation from landscape while a webView is inside a ScrollableView, the webView doesn't resize when returning to Portrait.

Sample code below. Change orientation scroll through a few, change back to Portrait. You might have to change orientation 2-3 times to see the effect.

var win = Titanium.UI.currentWindow;

var views = [];

for(var i = 0; i < 25; i++) {
    views.push(Ti.UI.createWebView({
        html: '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>',
        left: 20,
        right: 20,
        backgroundColor: '#eee'
    }));
}

var sv = Ti.UI.createScrollableView({
    left: 20,
    right: 20,
    top: 20,
    clipViews: false,
    views: views    
});

win.add(sv);

Comments

  1. Alan Leard 2011-04-15

    Another Ticker Reference: http://developer.appcelerator.com/helpdesk/view/76610">http://developer.appcelerator.com/helpdesk/view/76610

  2. Reggie Seagraves 2011-04-15

    This has become a high priority issue for LA Time shipping. Let's look at this as soon as we get the memory fixes in.

  3. Blain Hamon 2011-04-15

    Out of curiosity, when should we mention https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html"> https://developer.apple.com/library/ios/#documentation/UIKit/Refere... , where Apple says:

       Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled.
       

    Should this at least be in our docs about voiding the warranty, so to speak?

  4. Rick Blalock 2011-04-15

    I let the customer know about this from the beginning when we got the requirements from their client. There are a lot of examples of apps not following this out in the app store (i.e. CNN has a scrollview with webviews inside) - so from their perspective this lighthouse ticket / issue should still be fixable.

  5. Reggie Seagraves 2011-04-18

    LA Times shipped. We're deferring this to 1.8.0.
  6. Blain Hamon 2011-06-03

    Aha. I was about to mark this hold, because I can recreate it outside of titanium, without any scrollable view, but then figured we were doing things wrong. Turns out we are. https://developer.apple.com/library/safari/#technotes/tn2010/tn2262/_index.html The HTML *must* have the following meta tag in order to properly size: "But," you might say, "It still scrolls to a smaller degree when rotating!" And that is correct. The device-width is 768, but does not take into consideration that the actual webview is only 686 pixels wide. In testing, doing something akin to: Solved the test case. Because of how various html pages may be specifically crafted, WebView will not do this automatically; this is left to the end developer on how to present their page.
  7. Blain Hamon 2011-06-03

    See comments: Apple requires the web page have specific meta tags for the behavior desired.
  8. Blain Hamon 2011-06-20

    Typo was above: It should have read:
  9. Lee Morris 2017-03-24

    Closing ticket as invalid.

JSON Source