views:

58

answers:

1

I want to use touch event methods for UIScrollView. But it was said that I could do this only if I subclass UIScrollView and write these functions inside it. So i did like this

SubClassing.h
 @interface ImageTiling : UIScrollView {
}
@end

SubClassing.m
#import "ImageTiling.h"


 @implementation ImageTiling

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Touched" message:@"YOOY" delegate:nil cancelButtonTitle:@"YES" otherButtonTitles:nil];
[alert show];
[alert release];
}



- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Ended" message:@"YOOY" delegate:nil cancelButtonTitle:@"YES" otherButtonTitles:nil];
[alert show];
[alert release];
}
@end

But its not having any effect. I have imported that in my main_file.h. What should I do now?

A: 

Did you change your UIScrollView outlet class type in Interface Builder to your ImageTiling class?

Also, you would be better off using NSLog(@"Ended"); instead of displaying a UIAlertView for your debugging purposes.

Matt Long
If you mean class identity, I changed it but to no effect. Ya, I will use NSLog from now on.
wolverine
Have you set a delegate that implements UIScrollViewDelegate?
Matt Long