【发布时间】:2011-03-14 06:01:49
【问题描述】:
我创建了一个应用程序,我想在其中使用 touchbegan 方法。为此,我使用了以下代码:
- (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 时,会调用上述方法。
我不知道它是如何发生的。
【问题讨论】:
标签: iphone objective-c cocoa-touch