IOS-TODOLIST

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


注意新建立了一个 

UITableViewController的类绑定到TABLEVIEW


点击某行,进入新界面:

     主意新界面要去设置identifier 为tododetail

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

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

              

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

        

        viewController.rowIndex = indexPath.row

        

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

        

    }


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


    var rowIndex = 0;

    

    override func viewDidLoad() {

        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!



你可能感兴趣的:(IOS-TODOLIST)