UITouches not detecting
My UItouches is not detecting in my Slideshow nib file. What is the problem? Can anyone help?
@class Slideshow;
@interface RootV开发者_JAVA技巧iewController : 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
Slideshow is a UIViewController
and touchesBegan
is only called on a UIView
. You need to subclass UIView
to capture touches.
精彩评论