Skip to content

Instantly share code, notes, and snippets.

@drart
Forked from C4Examples/C4Workspace.m
Created September 22, 2013 04:18
Show Gist options
  • Save drart/6656653 to your computer and use it in GitHub Desktop.
Save drart/6656653 to your computer and use it in GitHub Desktop.
//
// C4WorkSpace.m
//
// Created by Greg Debicki.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Slider *slider;
C4Shape *shape;
CGPoint p;
}
-(void)setup {
shape = [C4Shape rect:CGRectMake(0, 0, 200, 200)];
p = self.canvas.center;
p.y -= 50;
shape.center = p;
[self.canvas addShape:shape];
slider = [C4Slider slider:CGRectMake(0, 0, 400, 44)];
p.y += 200;
slider.center = p;
[slider runMethod:@"adjustRotation:" target:self forEvent:VALUECHANGED];
[self.canvas addSubview:slider];
}
-(void)adjustRotation:(C4Slider *)sender {
shape.rotation = sender.value * TWO_PI;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment