相关疑难解决方法(0)

UIButton TouchUpInside触摸位置

所以我有一个大的UIButton,它是一个UIButtonTypeCustom,并且需要按钮目标UIControlEventTouchUpInside.我的问题是如何确定UIButton触摸发生的位置.我想要这个信息,所以我可以从触摸位置显示一个弹出窗口.这是我尝试过的:

UITouch *theTouch = [touches anyObject];
CGPoint where = [theTouch locationInView:self];
NSLog(@" touch at (%3.2f, %3.2f)", where.x, where.y);
Run Code Online (Sandbox Code Playgroud)

和各种其他迭代.按钮的目标方法通过以下方式从中获取信息sender:

    UIButton *button = sender;
Run Code Online (Sandbox Code Playgroud)

那么,有没有办法,我可以使用类似:button.touchUpLocation

我在网上看了找不到类似的东西,所以提前谢谢.

iphone touch uibutton uitouch sender

31
推荐指数
2
解决办法
1万
查看次数

标签 统计

iphone ×1

sender ×1

touch ×1

uibutton ×1

uitouch ×1