repeat background image
I have create a view:
var justifyLabelview = Ti.UI.createView({
backgroundImage: "images/black_dot.png"
});
is it possible to repeat the background image as we can do in CSS?
background-repeat: repeat-x;
7 Answers
-
I've managed to add it like this:
Open up TiUiView.m in your mobilesdk folder and add the following before @end
-(void)setRepeatedBackgroundImage_:(id)image { NSURL *bgURL = [TiUtils toURL:image proxy:proxy]; UIImage *resultImage = [[ImageLoader sharedLoader] loadImmediateImage:bgURL]; self.backgroundColor = [UIColor colorWithPatternImage:resultImage]; }
And use it in your project like so:
Ti.UI.createView({repeatedBackgroundImage:'something.png'});
-
In SDK 1.8.1 (beta) you can add 'backgroundRepeat: true' to a view and it will tile the background image.
As of this date, it is not yet implemented for Android. Watch http://jira.appcelerator.org/browse/TIMOB-6586.
-
use this
backgroundRepeat : true
-
nice, i'll ask platform team to add this to 1.8 consideration timeline.!
-
I've been unable to get this working. Any word on it being a built in thing?
-
Does anyone know if this has been added or not recently?
-
Don't know if this question needs any answering, but from 2.1.x version 'backgroundRepeat' property is available for both android and iphone