开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜