2015-11-04 101 views

回答

0

試試下面的代碼:

let cSelector : Selector = 「swipeAction」 

let rightSwipe = UISwipeGestureRecognizer(target: self, action: cSelector) 
rightSwipe.direction = UISwipeGestureRecognizerDirection.Right 
mainTableView.addGestureRecognizer(rightSwipe) // Or you can add it to cell 

,打造刷卡動作:

func swipeAction() 
{ 
    // TODO 
    self.performSegueWithIdentifier("segueId", sender: nil) 
} 

或者你也可以直接撥打電話Segue公司形成當你刷卡細胞(如果實現,而內置刷卡一樣canEditCellForRow

並實行prepareForSegue方法

// MARK: - Navigation 

// In a storyboard-based application, you will often want to do a little preparation before navigation 

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 

    // Get the new view controller using segue.destinationViewController. 
    // Pass the selected object to the new view controller. 

    let controller = segue.destinationViewController as YourDestViewController 
    controller.someData = // Pass some object if you need 
} 
0

瓶坯在代碼中SEGUE,你可以使用的代碼行:self.preformSegueWithIdentifyer("idenyidfyer",nil。要在視圖控制器中創建一個segue,請控制從視圖控制器單擊並拖動到所需的視圖控制器。點擊segue並將標識符更改爲任何你想要的。

+0

該代碼行與我寫的代碼非常相似,不完全相同。 –