Tile background images?

You must Login before you can answer or comment on any questions.

I would like to repeat background images, so I don't have to make a lot of images for every orientation on the iPad.

Is it possible to do this in Titanium? If not, do anyone have any suggestions on how to repeat background-patterns?

3 Answers

I believe only TableViews currently support background image tiling in Titanium.

In Objective-C you can achieve this easily with one line of code:

view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"tiles.png"]];
It should be pretty simple to add this functionality to all views in Titanium, maybe by adding a new property along the lines of {backgroundImageTiled: true}. I suggest you check if maybe there's a ticket already created for this or create it here.

— answered 3 years ago by Goran Skledar
answer permalink
2 Comments
  • Thanks for your answer. I made a ticket now and I hope there will be a smooth way to do this in the future.

    — commented 3 years ago by Marcus Olovsson

  • Thanks guys. I've been trying to find an answer to this too. I'll be sure to keep my eye out on that.

    — commented 3 years ago by Micah Rich

Need that too!

The only workaround I've found, is to dynamically generate views, which is pretty slow.

You could add a webview to your window and the html content of the webview would just be some html/css to tile your background. Just make sure you add your UI components to the window after the webview. It's not elegant at all, but it works.

Your Answer

Think you can help? Login to answer this question!