2010-06-08 90 views
0

我的UItouches未在我的幻灯片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 
+0

什么类型的幻灯片?它是否从UIResponder继承? – 2010-06-08 05:56:37

回答

0

幻灯片是一个UIViewControllertouchesBegan只叫上UIView。您需要继承UIView以捕捉触摸。

+0

对不起,我对xcode很陌生。那么应该将哪些代码添加到我的当前代码中以区分UIView? – Tony 2010-06-08 14:01:23