我想在我的UITableView
包括一個刷卡功能,我想從那裏執行一個segue。例如,當細胞刷卡向左它揭示了一個Edit
按鈕,當按下這個編輯按鈕,它會打開一個新的ViewController.UI
如何觸發一個從UITableView刷卡到swift快速編輯
2
A
回答
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並將標識符更改爲任何你想要的。
相關問題
- 1. UITableView編程快速
- 2. ViewPager快速刷卡給IndexOutOfBoundsException
- 3. 如何從一個UITableView中刪除一個UITableView的多節快速
- 4. NetBeans和GWT在開發模式下快速編輯/刷新
- 5. 編輯UITableView行項目swift
- 6. 如何使用Harp快速編輯HTML
- 7. 編輯快速編輯文本
- 8. JQuery Mobile刷卡事件只觸發每隔一次刷卡
- 9. 編輯UITableViewCells在一個UITableView
- 10. SQL Server 2008 - 從選擇快速編輯
- 11. 觸發靜態UITableView中的單元格時觸發一個動作[Swift]
- 12. 發送一個快速實例到http.createServer
- 13. 刷卡刪除UITableView
- 14. 刷卡swift編輯sqlite數據庫內容
- 15. 自動刷新UITableVIew單元格(編輯)
- 16. jQuery編輯插件,允許您觸發從另一個元素編輯
- 17. 如何在編輯url時觸發$ routeprovider
- 18. 快速刷新DataGridView中的按鈕點擊事件不一致觸發
- 19. SWIFT 2的UITableView刷新Almofire
- 20. 另一個快速類的觸發器動作
- 21. Android刷卡速度
- 22. 如何創建一個快速界面來編輯/刪除/添加數據庫?
- 23. Swift:如何通過快速操作訪問AppDelegate中的某個TabBar選項卡?
- 24. makefile:如何快速編譯
- 25. IDE如何快速編譯?
- 26. 如何處理觸動編輯按鈕(UITableView)的事件?
- 27. 將數據從一個視圖控制器傳遞到下一個無需快速編輯
- 28. 在編輯期間快速lexing
- 29. jQuery的快速編輯問題
- 30. '快速文本'編輯像MS字 - WPF
該代碼行與我寫的代碼非常相似,不完全相同。 –