Reputation: 23883
I can't switch to another view controller using UITableView. My code is like below.
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)
}
I click one of my cells, and it just does nothing.
Upvotes: 0
Views: 424
Reputation: 23883
I already found the answer, I forgot to put UITableViewDelegate
.
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
}
And assign tableview with view controller
Upvotes: 1