Skip to content

Instantly share code, notes, and snippets.

@evanlong
Created January 1, 2012 12:04
Show Gist options
  • Save evanlong/1547154 to your computer and use it in GitHub Desktop.
Save evanlong/1547154 to your computer and use it in GitHub Desktop.
For Leafo
/*
See screenshot: http://cl.ly/1v1H0Q1z0Z3R0z3X1R25
*/
- (void)loadView {
self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
CGFloat width = self.view.frame.size.width;
CGFloat segmentSize = width / 128;
int count = 0;
for (int i = 0; i < 128; i++) {
for (int j = 0; j < 128; j++) {
CGRect position = CGRectMake(i * segmentSize, j * segmentSize, segmentSize, segmentSize);
UIView *nextView = [[[UIView alloc] initWithFrame:position] autorelease];
nextView.backgroundColor = [UIColor colorWithRed:(arc4random()%255) / 255.0f green:(arc4random()%255) / 255.0f blue:(arc4random()%255) / 255.0f alpha:1.0f];
[self.view addSubview:nextView];
count++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment