UIScrollView touchesShouldBegin withEvent inContentView
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
Parameters of [UIScrollView touchesShouldBegin withEvent inContentView]
touches
A set of UITouch instances that represent the touches for the starting phase of the event represented by event.
event
An object representing the event to which the touch objects in touches belong.
view
The subview in the content where the touch-down gesture occurred.
Return Value
Return NO if you don’t want the scroll view to send event messages to view. If you want view to receive those messages, return YES (the default).
Discussion of [UIScrollView touchesShouldBegin withEvent inContentView]
The default behavior of UIScrollView is to invoke the UIResponder event-handling methods of the target subview that the touches occur in.
UIScrollView touchesShouldBegin withEvent inContentView example.
- (BOOL) touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view {
if ([touches count] == 2) {
return YES;
}
else {
return NO;
}
}
if ([touches count] == 2) {
return YES;
}
else {
return NO;
}
}
Example of [UIScrollView touchesShouldBegin withEvent inContentView].
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
{
id element;
NSEnumerator *setEnum = [touches objectEnumerator];
while ((element = [setEnum nextObject]) != nil)
{
NSLog(@"element:%@", element);
}
return [super touchesShouldBegin:touches withEvent:event inContentView:view];
}
{
id element;
NSEnumerator *setEnum = [touches objectEnumerator];
while ((element = [setEnum nextObject]) != nil)
{
NSLog(@"element:%@", element);
}
return [super touchesShouldBegin:touches withEvent:event inContentView:view];
}
UIScrollView touchesShouldBegin withEvent inContentView example.
/*
The default behavior of UIScrollView is to invoke
the UIResponder event-handling methods of the target subview that the touches occur in.
*/
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
{
BOOL ret;
ret = [super touchesShouldBegin:touches withEvent:event inContentView:view];
#if TRACE_TOUCH_ENABLE
if(ret)
NSLog(@"SwTextView touchesShouldBegin,return YES");
else
NSLog(@"SwTextView touchesShouldBegin,return NO");
#endif
return ret;
}
The default behavior of UIScrollView is to invoke
the UIResponder event-handling methods of the target subview that the touches occur in.
*/
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
{
BOOL ret;
ret = [super touchesShouldBegin:touches withEvent:event inContentView:view];
#if TRACE_TOUCH_ENABLE
if(ret)
NSLog(@"SwTextView touchesShouldBegin,return YES");
else
NSLog(@"SwTextView touchesShouldBegin,return NO");
#endif
return ret;
}