Why my own UIViewController can't detect touch?
- by Tattat
I have my OwnViewController, the viewDidLoad is like this:
    - (void)viewDidLoad {
        [super viewDidLoad];
        UIImage *img = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myImg" ofType:@"png"]];
        CGRect cropRect = CGRectMake(175, 0, 175, 175);
        CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], cropRect);
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 175, 175)];
        imageView.image = [UIImage imageWithCGImage:imageRef];
        self.view = imageView;
        CGImageRelease(imageRef);
}
It works, and I have detect touches method like this:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"touchesBegan");
}
But my UIView can't detect any touches. My Own UIViewController is a subclass of UIViewController. It is a little square view on the IB, why that can't detect touches? thx u.