Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-27-2009, 08:21 AM   #21 (permalink)
hakimny
Registered Member
 
Join Date: Aug 2008
Posts: 66
Default

Quote:
Originally Posted by anuragphadke View Post
Scott,
I am trying to implement what you said.. Here's my code
I added a hittest method in my ScrollView
Code:
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
	scrollView.delaysContentTouches = YES;
        return self;
The above code allows me to detect all my touches in UIScrollview. For eg:
Code:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
	NSLog(@"touch moved");
}
However, I can no longer perform any swipe, scroll or any other gesture in my WebView class implemented inside UIScrollView.

without
Code:
return self
everything works but I cannot recognize any gestures.

Any tips?

This is what I use in my subclass of UIScrollView

// Code begin here

@implementation MyScrollView
@synthesize imageId;

-(void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{

NSLog(@"Inside Touches Began");
if (!self.dragging) {
//********** not Dragging ***************
[self.nextResponder touchesEnded: touches withEvent:event];

for (UITouch *touch in touches) {

for (int i = 1; i < [self subviews].count; i++)
{
//Looping thru all images to see which one was touched

if(CGRectContainsPoint([[self viewWithTag:i]frame], [touch locationInView:self])){
NSLog(@"touched %d th view",i);
//get current image if not dragging
self.imageId = i;
}
}
}


}

else{
for (UITouch *touch in touches) {

for (int i = 1; i < [self subviews].count; i++)
{

//*************** Dragging **********************
if(CGRectContainsPoint([[self viewWithTag:i]frame], [touch locationInView:self])){
NSLog(@"touched %d th view",i+1);
//get next image if dragging
self.imageId = i+1;
}
}
}
}
[super touchesEnded: touches withEvent: event];
}

Hope this helps
hakimny is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,261
Threads: 39,058
Posts: 171,278
Top Poster: smasher (2,575)
Welcome to our newest member, SomeRandomNerd
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:52 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.