I have created an app in which I want to use the touchbegan method. For this I have used the following code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//Get all the touches.
NSSet *allTouches = [event allTouches];
//Number of touches on the screen
if([allTouches count] > 0 && self.view!=comparedView.view)
{
//Navigate to next screen here likewise you generally do
ActionViewController *actController = [[ActionViewController alloc] init];
UINavigationController *nvController = [[UINavigationController alloc]
initWithRootViewController:actController];
nvController.navigationBarHidden = YES;
CGRect frame = [[nvController navigationBar] frame];
frame = CGRectMake(0.0,0.0, 320.0, 460.0);
[[nvController navigationBar] setFrame:frame];
[self setView:[nvController view]];
[actController release];
}
}
On touch on anywhere on screen for my 1st view the following code will be executed and it will go to the next view. But problem is that when i go to the last view and touch on the imageview in that view the above method is called.
I am not getting how it is taking place.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)eventwill be called every time till the view controller get released or touch events are disabled.the view are being created and added to the same view conroller every time so the touch beganis called for all the views