Iphone 触摸法问题?

Iphone 触摸法问题?,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,我已经创建了一个应用程序,我想在其中使用TouchStart方法。为此,我使用了以下代码: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Get all the touches. NSSet *allTouches = [event allTouches]; //Number of touches on the screen if([allTouches count]

我已经创建了一个应用程序,我想在其中使用TouchStart方法。为此,我使用了以下代码:


- (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];

    }

}
在触摸我的第一个视图屏幕上的任意位置时,将执行以下代码,并转到下一个视图。但问题是,当我转到最后一个视图并触摸该视图中的imageview时,会调用上面的方法

我不知道它是如何发生的。

-(void)touchesbeated:(NSSet*)toucheevent:(UIEvent*)事件每次都将被调用,直到视图控制器被释放或触摸事件被禁用


每次都会创建视图并将其添加到同一个视图控制器中,因此所有视图都会调用touch beganis

否,但在第二个视图中不会调用它,而在第三个视图中仅在特定区域调用,而不是整个屏幕。self.view=comparedView.view打印相同的NSLog,您将找到原因