views:

42

answers:

1

Hi,

My UItouches is not detecting in my Slideshow nib file. What is the problem? Can anyone help?


@class Slideshow;
@interface RootViewController : UIViewController{
PreferencesController *preferencesController;
Slideshow *slideshow;}

Slideshow Implementation

@implementation Slideshow
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
NSLog(@"touches begin");
}
- (void)viewDidLoad
{

UIImageView *frontView = [[UIImageView alloc] initWithFrame:self.view.bounds];
frontView.backgroundColor = [UIColor blackColor];
frontView.image = [UIImage imageNamed:@"apple.png"];
frontView.userInteractionEnabled = YES;

[self.view addSubview:frontView];

[frontView release];
}@end
A: 

Slideshow is a UIViewController and touchesBegan is only called on a UIView. You need to subclass UIView to capture touches.

dc
Sorry, I'm very new to xcode. So what code should I add to my current code to subclass UIView?
Tony