Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 877

nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
02/24/13 03:58 PM (12 years ago)

iOS background pattern with UIcolor colorWithPatternImage?

Has anyone implemented an image pattern as a background. I am trying to do something similar to this but keep getting a white background - (void)viewDidLoad { [super viewDidLoad]; UIImage *patternImage = [UIImage imageNamed:@"pattern.png"]; self.view.backgroundColor = [UIColor colorWithPatternImage:patternImage]; } http://www.bobmccune.com/2011/03/08/ios-101-pattern-images/ Just wondering if the way buzztouch is set up has anything to do with this. Or if this is already implemented in buzztouch, and I just don't know about it.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/24/13 04:21 PM (12 years ago)
Haven't gotten that far yet, but it looks kind of neat... I'm not a graphics guy, so any tips in that area are always appreciated :) Cheers! -- Smug
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
02/24/13 04:40 PM (12 years ago)
Try to find where it sets the background image, then replace that code with this code. Jake
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
02/24/13 05:25 PM (12 years ago)
Hmm... May have had a bad (interlaced) .png file. I swapped the file out and the pattern worked just fine. Here is my implementation for any one that is curious. if([BT_strings getJsonPropertyValue:self.screenData.jsonVars:@"pattern_name":@""].length >3) { [BT_debugger showIt:self:@"set pattern"]; _patternName = [BT_strings getJsonPropertyValue:self.screenData.jsonVars:@"pattern_name":@""]; [BT_debugger showIt:self:_patternName]; _pattern = [UIImage imageNamed:_patternName]; _backGroundColor = [UIColor colorWithPatternImage:_pattern]; [self.view setBackgroundColor:_backGroundColor]; }
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
02/24/13 05:26 PM (12 years ago)
Very cool, will it be a plugin? Self hosted include file? Jake
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
02/24/13 06:36 PM (12 years ago)
It is part of the same plugin I have been working on for a while now. The screen uses a scroll view, so using pattern or texture images works better for a background.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.