[TIMOB-8298] iOS: Webview in scrollview does not have correct widhth/height after orientation change
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-12-20T21:52:40.000+0000 |
Affected Version/s | Release 1.8.2 |
Fix Version/s | Release 2.0.0, Sprint 2012-07 |
Components | iOS |
Labels | module_webview, qe-testadded, regression |
Reporter | Devang Gandhi |
Assignee | Sabil Rahim |
Created | 2012-03-25T16:23:31.000+0000 |
Updated | 2012-12-20T21:52:40.000+0000 |
Description
Webview in scrollview does not display correct width and height, when orientation changed. It works in 1.8.0.1, 1.8.1, but fails 1.8.2 and later.
Steps to reproduce:
Run the following code.
Scroll to the 2nd page which is google
Rotate the screen to landscape
Rotate to portrait, and the webview does not resize itself correctly
var win1 = Titanium.UI.createWindow({
backgroundColor:'white'
});
win1.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT];
var webview1 = Ti.UI.createWebView({
url: 'http://www.appcelerator.com'
});
var webview2 = Ti.UI.createWebView({
url: 'http://www.google.com',
scalesPageToFit:true
});
var webview3 = Ti.UI.createWebView({
url: 'http://www.apple.com'
});
var scrollableView = Ti.UI.createScrollableView({
views: [webview1, webview2, webview3]
});
win1.add(scrollableView);
win1.open();
Tangentially related, we should discourage developers from this practice of having a web view or table view inside a scroll view or scrollable view. As per [Apple](https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIWebView_Class/Reference/Reference.html): {quote} 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. {quote} In other words, even with this fixed, it is a very BAD idea to use web views inside a scrollable view.
Closing issue Tested with Ti Studio build 2.0.0.201203271933 Ti Mobile SDK 2.0.0.v20120328000206 hash r7985dee6 OSX Lion 10.7.3 iPhone 4S OS 5.0.1 Verified that the webview was resized correctly
Reopening/closing to add tags
Reopening/closing to add/remove labels
Pinch/Zoom of a page cause it not to scale properly after rotation. Same behavior in 2.1.4 Test steps: 1 Run the above code 2 Pinch/zoom a web view 3 Rotate device Actual result: page is not scaled to fit the screen Tested on: Titanium Studio, build: 3.0.0.201211281826 Titanium SDK, build: 3.0.0.v20121128173200 Devices: iPad mini iOS 6.0.1 iPad4 iOS 6.0
Closing, behavior as expected. Tested on: Titanium Studio, build: 3.0.1.201212181159 Titanium SDK, build: 3.1.0.v20121220122601 Titanium SDK, build: 3.0.1.v20121218130634 MacBookPro 10.8.2 Mountain Lion XCode 4.5.2 Device: iPhone5 iOS 6.1 iPad mini 6.0.2