-1

任何人都可以知道如何获得触摸颜色UIView吗?当我触摸视图时,我想要视图触摸区域上的颜色。谢谢

4

1 回答 1

2

您可以使用此开源来执行此操作。UIView这是一个具有附加功能的类别。

添加后,您可以获得如下颜色:

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

还要检查iPhone UIImage 像素颜色

这是SO中另一个线程的链接

于 2013-01-01T04:47:28.213 回答