我无法使用 UITableView 切换到另一个 View Controller 。我的代码如下所示。
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let dashViewController = storyBoard.instantiateViewControllerWithIdentifier("menuView") as DashViewController
self.presentViewController(dashViewController, animated:true, completion:nil)
}
我点击了我的一个单元格,但它什么也没做。
最佳答案
我已经找到答案了,我忘了放UITableViewDelegate
。
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
}
并为tableview分配view controller
关于ios - 在 Swift 中使用 UITableView 以编程方式切换 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28184105/