2013-02-01 87 views

回答

0

UITapGestureRecognizer加到您的UIView。当您收到轻按时,请检查您的识别器的locationInView:。如果轻敲发生在您想要进行轻击的区域,触发该操作;否则,忽略轻敲事件。

+3

如果您不需要解析精确的位置,您也可以简单地在该区域上放置一个透明按钮。 –

+0

辉煌。感谢热舔和dasblinkenlight! – objectiveccoder001

+0

我刚刚实现了透明按钮,完美的作品!同时启用“隐藏”,只要我不希望它可点击。 – objectiveccoder001

2

使用UITapGestureRecognizer,把透明的按钮置于想要获得

3

可点击的部分区域添加自定义的UIButton在您看来,什么都定位你需要点击,然后对其执行 行动。

UIButton *button = [UIButton buttonWithType:0]; 
    [button setFrame:CGRectmake(0,0,0,0)]; //What ever clickable area, provide here 
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];