Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8449] Mobile Web: Add support for repeating backgrounds on a view that is similar to background-repeat property in CSS

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-06-06T10:33:15.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.1.0, Sprint 2012-12 MW
ComponentsMobileWeb
Labelsparity, qe-testadded
ReporterJeff Haynie
AssigneeChris Barber
Created2012-03-30T11:45:53.000+0000
Updated2012-06-13T15:48:33.000+0000

Description

PROBLEM A customer wants to create titled backgrounds, so they look the same in any platform, and they don't have to generate different background images for each different platform. There is a screenshot showing the expected behavior. Additionally, you can see an example of code that will do the same effect, using insane amount of memory:
win = Ti.UI.createWindow();

var background = Ti.UI.createView();

var image1 = Ti.UI.createImageView({
 // use whatever image you have here
  image: 'appicon.png',
  height: 'auto',
  width: 'auto'
});
 
var width=image1.size.width;
var height=image1.size.height;

var deviceW= Titanium.Platform.displayCaps.platformWidth;
var deviceH= Titanium.Platform.displayCaps.platformHeight;

var repeatX = (deviceW % width) + 1; 
var repeatY = (deviceH % height) + 1; 


for(i=0;i<repeatX; i++)
	for(j=0;j<repeatY; j++){
		background.add(Ti.UI.createImageView({
			image: 'appicon.png',
			height: 'auto',
			width: 'auto',
			top:j*height, 
			left:i*width,
		}));
	}
	
win.add(background);
win.open();

Attachments

FileDateSize
app.js2012-06-05T18:05:44.000+0000274

Comments

  1. Chris Barber 2012-06-05

    Pull request: https://github.com/appcelerator/titanium_mobile/pull/2333
  2. Dustin Hyde 2012-06-13

    Closing as Fixed. Verified via attached app.js file. SDK: 2.1.0.v20120613120250 Studio: 2.1.0.201206121914 OS: Snow Leopard Browsers Tested: Chrome, Firefox

JSON Source