[TIMOB-8449] Mobile Web: Add support for repeating backgrounds on a view that is similar to background-repeat property in CSS
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-06-06T10:33:15.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Release 2.1.0, Sprint 2012-12 MW |
Components | MobileWeb |
Labels | parity, qe-testadded |
Reporter | Jeff Haynie |
Assignee | Chris Barber |
Created | 2012-03-30T11:45:53.000+0000 |
Updated | 2012-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
File | Date | Size |
---|---|---|
app.js | 2012-06-05T18:05:44.000+0000 | 274 |
Pull request: https://github.com/appcelerator/titanium_mobile/pull/2333
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