IOS-TODOLIST

阅读 76

2022-12-13


sb上先加入NavigationController ,拖拽TABLEVIEW上去,上面再放入Navigation Item (里面放入Bar Button Item)。


注意新建立了一个 

UITableViewController的类绑定到TABLEVIEW


点击某行,进入新界面:

tododetail

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

NSLog("click is:\(indexPath.row)")

              

        var viewController = self.storyboard?.instantiateViewControllerWithIdentifier("tododetail") as!ViewController

        

rowIndex = indexPath.row

        

self.navigationController?.pushViewController(viewController, animated: true)

        

    }



明细页面,LABLE的OUTLET是使用CTROL拖拽法自己生成的


var rowIndex = 0;

    

override func

super.viewDidLoad()

        // Do any additional setup after loading the view, typically from a nib.

        labe1.text = "Row index is:\(rowIndex)"

        

    }

    @IBOutlet weak var labe1: UILabel!




精彩评论(0)

0 0 举报