Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-27-2009, 09:21 AM   #21 (permalink)
hakimny
Registered Member
 
Join Date: Aug 2008
Posts: 70
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
 

» Advertisements
» Online Users: 508
15 members and 493 guests
Dani77, dljeffery, GameViewPoint, genialapps, JasonR, mediaspree, Punkjumper, rky, Rudy, sporting247, themathminister, tsai0507, WhiteWidget, youngdeveloper
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,751
Threads: 89,202
Posts: 380,572
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jadebair24
Powered by vBadvanced CMPS v3.1.0

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