3
我知道uiview沒有導航控件。因此,我無法將uiview推到下一個uview控制器。如何從UIView導航到UIViewController
這裏是我的方法的代碼。請幫忙。謝謝!
- (void)scrollViewDoubleTapped:(UITapGestureRecognizer*)recognizer {
CGPoint pointInView = [recognizer locationInView:self];
NSLog(@"%f , %f",pointInView.x,pointInView.y);
if ((pointInView.x >= (231.0) && pointInView.x <=(293) && pointInView.y >= (193) && pointInView.y <=(218)))
{
// how to push to next viewcontroller here?
UIView *view = [UIGestureRecognizer view]; //what should i do for this code?
[self viewController];
}
}
-(TestViewViewController*)viewController
{
for (UIView *next = [self superview]; next; next = next.superview)
{
UIResponder *nextResponder = [next nextResponder];
if([nextResponder isKindOfClass:[TestViewViewController class]])
{
return (TestViewViewController*)nextResponder;
}
}
return nil;
}
喜喬治,我編輯的代碼,你建議,但我不知道怎麼了UIView鏈接到響應者。我編輯了上面的代碼。請看一下。謝謝! – benedict 2013-03-21 08:11:37
我發現你根本不明白你在做什麼。等待我將編輯答案 – 2013-03-21 09:11:42
嗨喬治。我將你的代碼添加到我的項目中,並在//你想要的區域添加這兩行代碼。 TestViewViewController * newViewController = [[TestViewViewController alloc] initWithNibName:nil bundle:nil]; [viewController.navigationController pushViewController:newViewController animated:YES]; } 但我遇到了一些錯誤: 'NSInvalidArgumentException' 的,理由是: '+ [UIGestureRecognizer視圖]:無法識別的選擇發送到類0x3f342908' 請幫助。謝謝喬治! – benedict 2013-03-21 09:58:41