2011-05-11 72 views
0

我做一個形式,它顯示的鑽石主要細節 當我選擇單列,頁面導航到第二頁「詳細信息頁」 其中顯示所選鑽石的全部細節.. (我使用單個UITableViewCell顯示鑽石的全部細節)iphone頁,導航上的UITableView

第一頁從第二頁導航。我的代碼是

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath 
*)indexPath { 

    self.DiamondDetail = [[DiamondDetail alloc] init]; 
    DimEntity *Dim = [DimArray objectAtIndex:indexPath.row]; 
    _DiamondDetail.Diamond = Dim; 
    self.title = @" Detail "; 
    [self.navigationController pushViewController: _DiamondDetail animated:YES]; 

    [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; 
} 

現在,,輸出詳細信息頁面 在導航欄左側有一個鍵自動生成說「詳細信息」 當點擊該按鈕頁面再次導航到第一頁..

但..

我想..

當用戶移動他/她的手指在iPad,IPhone表面/ UITableViewCell的

從右到左,那麼也一頁應導航..

我怎麼能

回答

1

對於你必須學習有關UISwipeGestureRecognizer

-(void)viewDidLoad { 
      [super viewDidLoad]; 

     // Swipe Left 
     UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] 
      initWithTarget:self action:@selector(handleSwipeLeft:)]; 

     swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft; 
     [self.view addGestureRecognizer:swipeLeft]; 
     [swipeLeft release]; 

     // Swipe Right 
     UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] 
      initWithTarget:self action:@selector(handleSwipeRight:)]; 

     swipeRight.direction = UISwipeGestureRecognizerDirectionRight; 
     [self.view addGestureRecognizer:swipeRight]; 
     [swipeRight release]; 
    } 
- (void)handleSwipeLeft:(UISwipeGestureRecognizer *)recognizer { 
[self.navigationController pushViewController: _DiamondDetail animated:YES] 
} 

- (void)handleSwipeRight:(UISwipeGestureRecognizer *)recognizer { 
[self.navigationController pushViewController: _DiamondDetail animated:YES] 
} 
+0

你好這個幫助感謝名單,,但我想,,,,,,,從_DiamondDetail頁面到ResultPage(UITableView顯示多個鑽石)Navigation然後 – 2011-05-11 12:00:16

+0

如何在表格視圖中使用此代碼.... – Aravindhan 2011-05-11 12:18:07