Re: UIControl touchInside property
Re: UIControl touchInside property
- Subject: Re: UIControl touchInside property
- From: Ricky Sharp <email@hidden>
- Date: Tue, 29 Sep 2009 10:12:21 -0500
I believe there is some "slop" area for controls in general.
For example, the Edit button in the nav bar in Mail when in a list of
messages. The initial tap must be within the defined bounds. But when
tracking off or back in, the bounds used to determine in vs out is
larger. That property appears to know another the larger area.
Sent from my iPhone
On Sep 29, 2009, at 9:31 AM, Roland King <email@hidden> wrote:
cocoa touch question - I have searched devforums with the usual
total lack of result.
UIControl has a 'touchInside' readonly property which, according to
the documentation returns
A Boolean value that indicates whether a touch is inside the
bounds of the receiver. (read-only)
but it doesn't really seem to do that. Experiments calling it each
time I get called on continueTrackingWithTouch:withEvent: shows that
it stays YES until the touch moves quite some distance from the
control (like about an inch on the iphone screen). Logging
touchInside along with a hitTest on the event, the touchInside and
hitTest are both YES inside the control, the hitTest instantly moves
to NO as I cross the border but touchInside stays YES for some
distance, eventually they both become NO. (code and output below).
Should I consider 'touchInside' to be more of a 'user-interface'
flag which is telling me that a touch has moved far enough from the
control that standard control behavior says we're now far enough
away to be considered 'outside' and 'inside' is really an area both
inside and some distance from the control? I'm fine with that if
that means my controls will act like the standard controls.
Anyone come across this and had similar thoughts? I'm happy to file
a documentation radar if I think I understand what's really going on
here.
-(BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent
*)event
{
CGPoint locInView = [ touch locationInView:self ];
NSLog( @"continue tracking: %d : %d", [ self isTouchInside ],
[ self hitTest:locInView withEvent:nil ] == self );
return YES;
}
2009-09-29 22:16:26.525 Buttonz[62084:207] begin tracking: 0 : 1
2009-09-29 22:16:28.754 Buttonz[62084:207] continue tracking: 1 : 1
2009-09-29 22:16:28.887 Buttonz[62084:207] continue tracking: 1 : 1
2009-09-29 22:16:29.188 Buttonz[62084:207] continue tracking: 1 : 1
... move to the edge ...
2009-09-29 22:16:31.126 Buttonz[62084:207] continue tracking: 1 : 0
2009-09-29 22:16:32.697 Buttonz[62084:207] continue tracking: 1 : 0
2009-09-29 22:16:32.763 Buttonz[62084:207] continue tracking: 1 : 0
... keep moving until about 1" away from the edge ...
2009-09-29 22:16:36.254 Buttonz[62084:207] continue tracking: 0 : 0
2009-09-29 22:16:36.272 Buttonz[62084:207] continue tracking: 0 : 0
... finger up ...
2009-09-29 22:16:36.472 Buttonz[62084:207] continue tracking: 0 : 0
2009-09-29 22:16:36.757 Buttonz[62084:207] end tracking: 0
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden