我想在我的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. 如何使用刷卡iphone應用程序控制UITableView編輯?
- 3. Android模擬快速刷卡
- 4. ViewPager快速刷卡給IndexOutOfBoundsException
- 5. 如何從一個UITableView中刪除一個UITableView的多節快速
- 6. NetBeans和GWT在開發模式下快速編輯/刷新
- 7. 編輯UITableView行項目swift
- 8. 如何防止刷卡觸發點擊?
- 9. 如何使用Harp快速編輯HTML
- 10. 編輯快速編輯文本
- 11. SQL Server 2008 - 從選擇快速編輯
- 12. JQuery Mobile刷卡事件只觸發每隔一次刷卡
- 13. 編輯UITableViewCells在一個UITableView
- 14. UITableView tableView(_:didEndEditingRowAt :)如果在刷卡過程中快速點擊,則不會調用
- 15. 快速YUI編輯器
- 16. 觸發靜態UITableView中的單元格時觸發一個動作[Swift]
- 17. 如何在iOS中快速刷新tableview按鈕swift
- 18. 發送一個快速實例到http.createServer
- 19. 刷卡刪除UITableView
- 20. 刷卡swift編輯sqlite數據庫內容
- 21. 自動刷新UITableVIew單元格(編輯)
- 22. jQuery編輯插件,允許您觸發從另一個元素編輯
- 23. 快速刷新與多個查詢一個PHP得到
- 24. 如何批量編輯觸發器?
- 25. 如何在編輯url時觸發$ routeprovider
- 26. SWIFT 2的UITableView刷新Almofire
- 27. 如何獲取UITableView中可編輯單元格的值? Swift
- 28. 快速刷新DataGridView中的按鈕點擊事件不一致觸發
- 29. 快速AJAX刷新
- 30. Swift:如何通過快速操作訪問AppDelegate中的某個TabBar選項卡?
該代碼行與我寫的代碼非常相似,不完全相同。 –