So I have a large UIButton
, it is a UIButtonTypeCustom
, and the button target is called for UIControlEventTouchUpInside
. My question is how can I determine where in the UIButton
the touch occured. I want this info so I can display a popup from the touch location. Here is what I've tried:
UITouch *theTouch = [touches anyObject];
CGPoint where = [theTouch locationInView:self];
NSLog(@" touch at (%3.2f, %3.2f)", where.x, where.y);
and various other iterations. The button's target method get info from it via the sender
:
UIButton *button = sender;
So is there any way I could use something like: button.touchUpLocation
?
I looked online and couldn't find anything similar to this so thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…