我有一个很大的UIButton
,它是一个UIButtonTypeCustom
,并且按钮目标被调用了UIControlEventTouchUpInside
。我的问题是如何确定触摸发生在UIButton
的哪个位置。我想要这个信息,以便我可以从触摸位置显示一个弹出窗口。以下是我尝试过的:
UITouch *theTouch = [touches anyObject];
CGPoint where = [theTouch locationInView:self];
NSLog(@" touch at (%3.2f, %3.2f)", where.x, where.y);
以及其他各种迭代方式。该按钮的目标方法通过 sender
从中获取信息:
UIButton *button = sender;
有没有办法使用类似于button.touchUpLocation
的东西?
我在网上搜索了一下,没有找到类似的内容,提前感谢。