Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8247] iOS: ImageView - ImageView does not auto size image view correctly

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-03-27T09:35:04.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-07
ComponentsiOS
Labelsparity, qe-and031912, qe-nfc
ReporterWilson Luu
AssigneeVishal Duggal
Created2012-03-23T13:38:50.000+0000
Updated2012-03-27T09:35:04.000+0000

Description

Steps to reproduce: 1. Run code on Android:
// Create an image view on a parent that is width and height constrained 
// See that the image view sizes itself accordingly 

var win = Ti.UI.createWindow();
win.backgroundColor = 'white';

var label = Ti.UI.createLabel({
	text: 'Image View should auto size to image, but stay within red',
	top: 20,
	left: 10,
	height: Ti.UI.SIZE,
	width: Ti.UI.SIZE,
	color: 'black'
});

var view1 = Ti.UI.createView({
	height: 30,
	width: 60,
	top: 80,
	backgroundColor: 'red'
});

var imageView1 = Ti.UI.createImageView({
	image: 'flower.jpg',
	backgroundColor: 'blue'
});

var view2 = Ti.UI.createView({
	height: 50,
	width: 120,
	top: 140,
	backgroundColor: 'red'
});

var imageView2 = Ti.UI.createImageView({
	image: 'flower.jpg',
	backgroundColor: 'blue'
});

var view3 = Ti.UI.createView({
	height: 70,
	width: 180,
	top: 220,
	backgroundColor: 'red'
});

var imageView3 = Ti.UI.createImageView({
	image: 'flower.jpg',
	backgroundColor: 'blue'
});


view1.add(imageView1);
view2.add(imageView2);
view3.add(imageView3);
win.add(view1);
win.add(view2);
win.add(view3);
win.add(label);

win.open();

Actual: ImageView will fill parent view. See attachment. Expected: ImageView should not fill parent view (respect image ratio). Note: * Above code works as expected on Android.

Attachments

FileDateSize
device-2012-03-23-143600.png2012-03-23T13:40:24.000+000061208
flower.jpg2012-03-23T13:38:50.000+000017766
on_ios.png2012-03-23T15:40:04.000+0000203978
Screen Shot 2012-03-26 at 12.52.17 PM.png2012-03-26T11:53:16.000+0000100786

Comments

  1. Wilson Luu 2012-03-23

    Ignore attachment with button.
  2. Tamila Smolich 2012-03-26

    Also occurs on: Titanium Studio, build: 2.0.0.201203262445 SDK: 2.0.0.v20120325213306 Device: Android Nexus S (2.3.6)
  3. Sitara Shylaja 2012-03-26

    this also fails on Android(2.2.2)- nexus one, when tests on Titanium mobilesdk-2.0.0.v20120325213306 Titanium Studio build: 2.0.0.201203262445
  4. Satyam Sekhri 2012-03-26

    Also occurs on Kindle Fire and Nook Color Titanium SDK: 2.0.0.v20120325213306 Titanium Studio, build: 2.0.0.201203262445
  5. Stephen Tramer 2012-03-26

    iOS Behavior in 1.8.2 attached; note image scaling rather than cropping behavior.
  6. Vishal Duggal 2012-03-26

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/1845
  7. Wilson Luu 2012-03-27

    Closing bug. Verified fix on: SDK build: 2.0.0.v20120326211803 Titanium Studio, build: 2.0.0.201203262445 xcode: 4.3 Device: iphone 4s Verizon (5.0.1)

JSON Source