我的幻灯片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 :(得分:0)
幻灯片显示为UIViewController
,touchesBegan
仅在UIView
上调用。您需要子类UIView
来捕获触摸。