A pure code implementation of http://dribbble.com/shots/929359-Camera-Switch
The image below is what this control looks in dribbble
and this is what my control looks like
similar but still have some difference in material.
Usage, creation:
self.cameraSwitch = [[RSCameraSwitch alloc] initWithFrame:CGRectMake(100, 100, 165, 50)];
self.cameraSwitch.tintColor = [UIColor blackColor];
self.cameraSwitch.offColor = [[self class] colorWithARGBHex:0xff498e14];
self.cameraSwitch.onColorLight = [[self class] colorWithARGBHex:0xff9dd32a];
self.cameraSwitch.onColorDark = [[self class] colorWithARGBHex:0xff66a61b];
self.cameraSwitch.delegate = self;
[self.view addSubview:self.cameraSwitch];
event handling:
- (void)clicked:(BOOL)isFront
{
// When using GPUImage, put [self.videoCamera rotateCamera]; here,
// Otherwise do:
if (isFront) {
NSLog(@"front button selected");
} else {
NSLog(@"back button selected");
}
}