[TIMOB-3413] iOS: WebView doesn't resize correctly in scrollableView on orientation change
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-06-03T17:30:58.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2011-22 |
Components | iOS |
Labels | n/a |
Reporter | Rick Blalock |
Assignee | Blain Hamon |
Created | 2011-04-15T03:44:00.000+0000 |
Updated | 2017-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);
Another Ticker Reference: http://developer.appcelerator.com/helpdesk/view/76610">http://developer.appcelerator.com/helpdesk/view/76610
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.
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:
Should this at least be in our docs about voiding the warranty, so to speak?
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.
LA Times shipped. We're deferring this to 1.8.0.
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.
See comments: Apple requires the web page have specific meta tags for the behavior desired.
Typo was above: It should have read:
Closing ticket as invalid.