Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11949] iOS: Label backgroundImage not set correctly on creation

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-04-08T08:17:07.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.3.0
ComponentsiOS
Labelsmodule_label, qe-closed-3.3.0, qe-testadded
ReporterMartin Guillon
AssigneeVishal Duggal
Created2012-11-03T14:08:12.000+0000
Updated2014-05-06T09:34:16.000+0000

Description

Following a [pull request](https://github.com/appcelerator/titanium_mobile/pull/2932) of mine, a regression appeared. Setting backgroundImage on creation was not working. This is due to the fact that the layer was not created.
var win = Ti.UI.createWindow({backgroundColor:'white'});

var label = Ti.UI.createLabel({
	width:100,
	height:60,
	top:50,
	left:10,
	text:'This is a test',
	backgroundPaddingTop:20,
	backgroundPaddingLeft:20,
	backgroundPaddingRight:20,
	backgroundImage:'KS_nav_UI.png'
})
win.add(label);

var b3 = Titanium.UI.createButton({
	title:'animate',
	height:40,
	width:200,
	bottom:10
});
var small = false;
b3.addEventListener('click', function()
{
	if (!small)
		label.animate({
			width:140,
			height:25,
			top:10,
			left:40
		});
	else
		label.animate({
			width:100,
		height:60,
		top:50,
		left:10
		});
	small = !small;
});
win.add(b3);
win.open();
Now the label doesnt have a custom bgd layer. Instead it uses the TiUIView bgd layer. And it overloads the method used to set the frame of the bgd layer to add padding The example shows that setting the background image works on creation. But also that the new implementation didnt break padding, even with animations.

Comments

  1. Martin Guillon 2012-11-03

    pull request https://github.com/appcelerator/titanium_mobile/pull/3376
  2. Ingo Muschenetz 2014-04-07

    Need to verify that this may already be fixed.
  3. Sabil Rahim 2014-04-08

    Cannot Reproduce with latest master with the test case from above. This could have fixed with the other view refactor that we had made in 3.3.0. Marking as Fixed.
  4. Priya Agarwal 2014-05-06

    Verified the issue: Appc-Studio:3.3.0.201405011408 sdk:3.3.0.v20140505115416 acs:1.0.14 alloy:1.4.0-dev npm:1.3.2 titanium:3.3.0-dev titanium-code-processor:1.1.1 xcode:5.1.1 Device:Ipod Touch1(7.0),Nexus7(v4.3) Label backgroundImage set properly while creation. Used the above mentioned code in description.

JSON Source