views:

295

answers:

1

I have a problem to find the touch point.

I have a function loadView() where I set 16 tiles(16 UIImage View).

Then In function:

- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
    // Retrieve the touch point

    UITouch *touch=[[event allTouches]anyObject];
    CGPoint point= [touch locationInView:touch.view];
    CGRect frame = [self frame];  // Error this Line
}

I have Used frame to identify which frame/tiles is pressed using frame-origin.

But This Line

CGRect frame = [self frame];

makes me crazy.Plz someone tell me What to do.(with explanation and why not working).Plz.

+1  A: 

It seems like you're trying to do this in a method in a UIViewController subclass. The line should probably be:

[self.view frame];
Felixyz