Swift 3 popup model dialog传递数据

Swift 3 popup model dialog传递数据,第1张

概述@IBAction func txtPasswordClicked(_ sender: Any) { let popupKeyboardVC = storyboard?.instantiateViewController(withIdentifier: "popupKeyboard") as! PopupKeyboardVC popupKeyboa
      @IBAction func txtPasswordClicked(_ sender: Any) {        let popupKeyboardVC = storyboard?.instantiateVIEwController(withIDentifIEr: "popupKeyboard") as! PopupKeyboardVC                popupKeyboardVC.delegate = self        //popupKeyboardVC.strSaveText=labelText.text                popupKeyboardVC.modalPresentationStyle = .popover        if let popoverController = popupKeyboardVC.popoverPresentationController {            popoverController.sourceVIEw = sender as! UIVIEw            popoverController.sourceRect = (sender as AnyObject).bounds            popoverController.permittedArrowDirections = .any            popoverController.delegate = self        }        present(popupKeyboardVC,animated: true,completion: nil)    }        func saveText(strText: Nsstring) {        txtPassword.text = strText as String;    }        // MARK: - UIPopoverPresentationControllerDelegate    func adaptivePresentationStyleForPresentationController(controller: UIPresentationController!) -> UIModalPresentationStyle {        return .fullScreen    }        func presentationController(controller: UIPresentationController!,vIEwControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIVIEwController! {        return UINavigationController(rootVIEwController: controller.presentedVIEwController)    }


d出的controller:

protocol SavingVIEwControllerDelegate{func saveText( strText : Nsstring)}class PopupKeyboardVC: UIVIEwController,UITextFIEldDelegate{overrIDe func vIEwDIDLoad() {}overrIDe func dIDReceiveMemoryWarning() {    super.dIDReceiveMemoryWarning()    // dispose of any resources that can be recreated.}@IBOutlet weak var btnDone: UIbutton!var delegate : SavingVIEwControllerDelegate?@IBAction func btnDoneClick(_ sender: Any) {    if (self.delegate) != nil    {        delegate?.saveText(strText: "abc")    }    self.dismiss(animated: true,completion: nil)}}
总结

以上是内存溢出为你收集整理的Swift 3 popup model dialog传递数据全部内容,希望文章能够帮你解决Swift 3 popup model dialog传递数据所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1090190.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存