Skip to content

Instantly share code, notes, and snippets.

@mani95lisa
Created July 16, 2013 11:52
Show Gist options
  • Save mani95lisa/6008051 to your computer and use it in GitHub Desktop.
Save mani95lisa/6008051 to your computer and use it in GitHub Desktop.
get the color of a pixel in an UIView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint loc = [touch locationInView:self];
self.pickedColor = [self colorOfPoint:loc];
[[NSNotificationCenter defaultCenter] postNotificationName:@"ColorPicked" object:self userInfo:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment