UITouches没有检测到

时间:2010-06-08 02:47:27

标签: iphone cocoa xcode

我的幻灯片nib文件中未检测到我的UItouches。问题是什么?有人可以帮忙吗?


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

幻灯片实施

@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

1 个答案:

答案 0 :(得分:0)

幻灯片显示为UIViewControllertouchesBegan仅在UIView上调用。您需要子类UIView来捕获触摸。