2012-08-14 54 views
0

目前我有主視圖和詳細視圖。在細節中,我添加了一個TapGestureRecognizer的圖像。然後在TapGestureRecognizer上,我添加了一個segue推回到主視圖。問題出在模擬器上,當我點擊圖像時,它將我帶到主視圖中,但導航器項目中的後退按鈕說明了詳細視圖的名稱。獲取點擊手勢鏈接回第一個視圖沒有後退按鈕?

我想要點擊手勢鏈接回第一個主視圖。而不是通過後退按鈕鏈接到主視圖。我怎麼能這樣做呢?我認爲這與準備Segue有關。

任何幫助?

在此先感謝!

回答

0

花了幾個小時,但我看到了我沒有需要賽格瑞只是不得不處理在我的課點擊手勢:

 UITapGestureRecognizer *singleFingerTap = 
     [[UITapGestureRecognizer alloc] initWithTarget:self 
               action:@selector(handleSingleTap:)]; 
     [self.view addGestureRecognizer:singleFingerTap]; 

    } 

    - (void)handleSingleTap:(UITapGestureRecognizer *)recognizer { 
     //The event handling method 
     [self.navigationController popToRootViewControllerAnimated:YES]; 
} 
0

只需彈出視圖控制器。調用方法:

[self.navigationController popViewControllerAnimated:YES]; 

它會回到上一個視圖。

相關問題