3

Is there a way to tile an image in objective-j on a CPView? something along the lines of:

  • [CPImage alloc] initWithPatternImage:@"Resources/grid.png" size:CGSizeMake(5.0, 5.0)]

Thanks guys ;)

spk
  • 31
  • 1

1 Answers1

0

Try this:

var image = [[CPImage alloc]
                initWithContentsOfFile:"Resources/myimage.gif"
                                  size:CGSizeMake(20, 20)]; 
var imageView = [[CPImageView alloc] initWithFrame:CGRectMake(0,0,500,500)];    
[imageView setBackgroundColor:[CPColor colorWithPatternImage:image]];
Jeremy Wall
  • 23,907
  • 5
  • 55
  • 73
Paul
  • 1,519
  • 1
  • 16
  • 26
  • You can set the background on any view, and you _shouldn't_ set it on an image view usually. Just remove the imageView line, and call the same thing on the regular view. patternImage's are automatically tiled when they are view backgrounds. – Ross Boucher Apr 26 '10 at 16:24