简体   繁体   English

UITouch不检测

[英]UITouches not detecting

My UItouches is not detecting in my Slideshow nib file. 我的UItouches没有在我的Slidenib文件中检测到。 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

Slideshow is a UIViewController and touchesBegan is only called on a UIView . 幻灯片是UIViewControllertouchesBegan仅在UIView上调用。 You need to subclass UIView to capture touches. 您需要将UIView子类化以捕获触摸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM