Return 函数值(操作按钮)
Return value from function (action button)
有谁知道如何从这个函数中得到 o return 值?
我要 return t ,值是一张图片
钯。我想 return 这个 viewcontroller
中的值
@IBAction func firmaButton(_ sender: Any) {
let storyBoard1 : UIStoryboard = UIStoryboard(name: "NuevaCuenta", bundle: nil)
let ViewControllerDos1 = storyBoard1.instantiateViewController(withIdentifier: "NCFirma") as! NCFirma
ViewControllerDos1.modalPresentationStyle = .fullScreen
ViewControllerDos1.clickedCallback = { t in
self.firmaButton.setImage(t, for: .normal)
self.firmaButton.transform = self.firmaButton.transform.rotated(by: CGFloat(M_PI_2))
self.firmaButton.frame = CGRect(x: 13, y: 8, width: 294, height: 112)
self.firmaButton.clipsToBounds = true
RegTempNuevaCuenta.imgFirma = t
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.myOrientation = .portrait
}
self.navigationController?.pushViewController(ViewControllerDos1, animated: true)
}
@IBAction
功能是基于用户交互的系统功能。他们 return 什么都没有,并且 return 类型对于这种类型的函数是 Void
虽然从技术上讲您不能 "return" 从这个函数中,但是 Swift 中肯定还有其他范例是为此而设计的。
如果您尝试在控制器之间传递值,请查看 this guide 协议和委托。
有谁知道如何从这个函数中得到 o return 值? 我要 return t ,值是一张图片 钯。我想 return 这个 viewcontroller
中的值@IBAction func firmaButton(_ sender: Any) {
let storyBoard1 : UIStoryboard = UIStoryboard(name: "NuevaCuenta", bundle: nil)
let ViewControllerDos1 = storyBoard1.instantiateViewController(withIdentifier: "NCFirma") as! NCFirma
ViewControllerDos1.modalPresentationStyle = .fullScreen
ViewControllerDos1.clickedCallback = { t in
self.firmaButton.setImage(t, for: .normal)
self.firmaButton.transform = self.firmaButton.transform.rotated(by: CGFloat(M_PI_2))
self.firmaButton.frame = CGRect(x: 13, y: 8, width: 294, height: 112)
self.firmaButton.clipsToBounds = true
RegTempNuevaCuenta.imgFirma = t
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.myOrientation = .portrait
}
self.navigationController?.pushViewController(ViewControllerDos1, animated: true)
}
@IBAction
功能是基于用户交互的系统功能。他们 return 什么都没有,并且 return 类型对于这种类型的函数是 Void
虽然从技术上讲您不能 "return" 从这个函数中,但是 Swift 中肯定还有其他范例是为此而设计的。
如果您尝试在控制器之间传递值,请查看 this guide 协议和委托。