Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11586] iOS: Using the backgroundGradient property changes the order in which views are added

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-11-16T19:02:35.000+0000
Affected Version/sRelease 2.1.3
Fix Version/sRelease 3.1.0, 2012 Sprint 23 API, 2012 Sprint 23
ComponentsiOS
LabelsParity, api, module_view, qe-testadded
ReporterNikhil Sharma
AssigneeVishal Duggal
Created2012-10-26T21:38:47.000+0000
Updated2014-04-23T14:20:52.000+0000

Description

Using backgroundGradient property to a view changes the order in which the views are added to it. It works fine on android. Please find attached screenshot with and without the backgroundGradient property.

Repo Steps

1. Run the below code in your project's app.js 2. You can see that the green view is behind the red view. The order of the views changes after adding the backgroundGradient property.
var win1 = Titanium.UI.createWindow({
	title : 'Tab 1',
	backgroundColor : '#fff'
});

var g_backgroundGradient = {startPoint: {x:0, y:0}, endPoint: {x:400, y:600}, colors:['blue', 'orange'], type: 'linear'};

var backview = Titanium.UI.createView({
	backgroundGradient : g_backgroundGradient // <<< COMMENT OUT THIS LINE TO FIX PROBLEM
});

var view1 = Titanium.UI.createView({
	backgroundColor : 'red',
	width : '300',
	height : '400',
	left : 15,
	top : 15,
	zindex : 10,
});

var view2 = Titanium.UI.createView({
	width : '100',
	height : '70',
	left : 5,
	top : 5,
	backgroundColor : 'green',
	zindex : 1
});
backview.add(view1);
backview.add(view2);

win1.add(backview);

win1.open(); 

Attachments

FileDateSize
with_backgroundGradient.png2012-10-26T21:38:47.000+000090559
without_backgroundGradient.png2012-10-26T21:38:47.000+000077466

Comments

  1. Vishal Duggal 2012-10-30

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/3357
  2. Satyam Sekhri 2013-01-20

    Views displayed in correct order. Verified on: Studio: 3.0.1.201212181159 SDK: 3.1.0.v20130114171802 iOS Device: iPhone Simulator (v6.0), iPhone4S (v5.1), iPhone5 (v6.0) XCode: 4.5.2

JSON Source