Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13243] iOS: ImageView - Image changes its position on the screen if orientation is changed

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-05-03T17:57:47.000+0000
Affected Version/sRelease 3.1.0
Fix Version/s2013 Sprint 08 API, 2013 Sprint 08, Release 3.1.1, Release 3.2.0
ComponentsiOS
Labelsmodule_imageview, qe-3.1.0, qe-testadded
ReporterAnshu Mittal
AssigneeVishal Duggal
Created2013-03-28T12:30:25.000+0000
Updated2013-07-24T11:16:29.000+0000

Description

Image changes its position on the screen if orientation is changed. This is not regression since the issue occurs on 3.0.2 GA as well. Steps to reproduce: 1. Create an app using the code below. 2. Launch the test app.Wait for the image to load. 3. Change Orientation to landscape and then again to portrait. Actual: The position of the image is changed on the screen. Expected: Position of the image should be same on the screen.

var win = Ti.UI.createWindow({
    backgroundColor: 'white'
});
 
var scrollView = Ti.UI.createScrollView({
    maxZoomScale: 3,
    contentWidth: 'auto',
    contentHeight: 'auto'
});
 
var img = Ti.UI.createImageView({
    image: 'photo.jpg',
    width:Ti.UI.SIZE,
    hight: Ti.UI.SIZE
});
 
function onImageLoad(e) {
    var scaleWidth = win.size.width / img.size.width;
    var scaleHeight = win.size.height / img.size.height;
    // Set the initial ZoomScale
    // And the MinZoomScale
    scrollView.zoomScale = scrollView.minZoomScale = Math.min(scaleWidth, scaleHeight);
}
 
img.addEventListener('load', onImageLoad);
 
scrollView.add(img);
win.add(scrollView);
win.open();

Attachments

FileDateSize
photo.jpg2013-03-28T12:30:25.000+0000467187

Comments

  1. Max Stepanov 2013-04-01

    PR https://github.com/appcelerator/titanium_mobile/pull/4063 3_1_X PR https://github.com/appcelerator/titanium_mobile/pull/4080
  2. Vishal Duggal 2013-04-17

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/4188
  3. Sabil Rahim 2013-04-22

    CR & FR
  4. Vishal Duggal 2013-04-22

    Backport to 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4203
  5. Anshu Mittal 2013-05-03

    Issue still occurs with the following environment: SDK:3.1.1.v20130502180055 Appcelerator Studio: 3.1.1.201305020729 OS: OSX 10.7.5 Device: iPadMini(6.0) Xcode: 4.6
  6. Sabil Rahim 2013-05-03

    make sure you are using the actual image (1600 × 1200 resolution) and not the thumbnail image. There is another ticket(TIMOB-13643) linked to this one which deals with smaller images not being positioned correctly. Cannot reproduce the issue marking ticket back to resolved status. Please re-test. Checked on SDK : 3.1.1.v20130502180055 TiStudio : 3.1.1.201304161846 OS: OSX 10.8 Device: iPadMini(6.0) Xcode: 4.6
  7. Anshu Mittal 2013-05-07

    Tested with: SDK:3.1.1.v20130503173050 Appcelerator Studio: 3.1.1.201305031846 OS: OSX 10.7.5 Device: iPadmini(v 6.0)

JSON Source