我是iOS
開發的新手。我想問的一件事,當我點擊tableViewCell
我想移動到新的viewController
,但當我點擊它給我注意。點擊tableview單元不能移動到新的控制器
這裏是我的代碼 -
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let row = indexPath.row
if row == 4
{
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let secondViewController = storyboard.instantiateViewControllerWithIdentifier("contact") as! contactsandlists
navigationController?.pushViewController(secondViewController, animated: true)
print("error")
}
請解決我的問題
錯誤是否打印? –
是錯誤被打印,但它不會移動到進一步的視圖控制器 – Bansal
在故事板,你需要嵌入你的當前控制器與NavigationController –