Skip to content

Instantly share code, notes, and snippets.

@matthusby
Created August 24, 2011 20:59
Show Gist options
  • Save matthusby/1169217 to your computer and use it in GitHub Desktop.
Save matthusby/1169217 to your computer and use it in GitHub Desktop.
MyView.j
@implementation MyView : CPView
{
CALayer _rootLayer;
}
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if (self)
{
[self setWantsLayer:YES];
_rootLayer = [CALayer layer];
[self setLayer:_rootLayer];
[_rootLayer setBackgroundColor:[CPColor darkGrayColor]];
[_rootLayer setNeedsDisplay];
}
return self;
}
@end
@implementation MyView2 : CPView
{
}
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if (self)
{
[self setBackgroundColor:[CPColor blueColor]];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment