传值

传值一定要注意,连接的B,跟赋值的B一定要是同一个

传值一定要注意,连接的B,跟赋值的B一定要是同一个

传值一定要注意,连接的B,跟赋值的B一定要是同一个




Segue 传值

//跳到add个人信息页面

        performSegue(withIdentifier: "toPeopleInformationViewController", sender: addDataDic)

        //这里特别要注意的是Segue要指向 B ViewController,如果不是ViewController传值会有问题的


   //在这个方法中给新页面传递参数

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

        if segue.identifier == "toPeopleInformationViewController"{

            let controller = segue.destination as! PersonalInformationViewController

            controller.personalInfoArray = sender as? [String : Any]

            controller.familyListReloadDelegate = self //这里还用到了代理反向传值,代理的赋值

            

        }

    }




通过xib获取ViewController,并传值

 let sb = UIStoryboard.init(name: "OwnOfSet", bundle: nil)

        let selectCommView = sb.instantiateViewController(withIdentifier:"SelectCommUITableViewController")as! SelectCommUITableViewController

        selectCommView.isCommPush = true

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



AppDelegate传值

 let appDelegate = UIApplication.shared.delegate as! AppDelegate

        accountTextField.text = appDelegate.username


猜你喜欢

转载自blog.csdn.net/weixin_39872861/article/details/80783978