-1

Can anybody know how to get touch color of UIView ? When I touch on a view then I want the color which is on touched area of the view. Thx

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
Nrml
  • 31
  • 3

1 Answers1

2

You can use this open source library for doing this. It's a category of UIView with additional features.

After adding this you can get the color like:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [[event allTouches] anyObject];
    NSLog("%@",[self colorOfPoint:[touch locationInView:self]]);
}

Also check iPhone UIImage Pixel Color

Here is a link to another thread in SO

Community
  • 1
  • 1
Midhun MP
  • 103,496
  • 31
  • 153
  • 200