import Foundation
protocol ChangeTextDelegate{
func changeLableValue(newString:String)
}
class OtherVC: UIVIEwController {
var delegate : ChangeTextDelegate?
overrIDe func vIEwDIDLoad() {
super.vIEwDIDLoad()
// Do any additional setup after loading the vIEw.
}
overrIDe func dIDReceiveMemoryWarning() {
super.dIDReceiveMemoryWarning()
// dispose of any resources that can be recreated.
@IBAction func otherbuttonClick(sender: UIbutton) {
delegate!.changeLableValue("这是第二个")
self.dismissVIEwControllerAnimated(true) { () -> VoID in
}
class VIEwController: UIVIEwController,ChangeTextDelegate {
func changeLableValue(newString: String) {
lable.text=newString
@IBOutlet weak var lable: UILabel!
@IBOutlet weak var btnClick: UIbutton!
@IBAction func buttonClick(sender: UIbutton) {
let storyBoard = UIStoryboard(name: "Main",bundle: nil)
let otherVc :OtherVC = storyBoard.instantiateVIEwControllerWithIDentifIEr("OtherVC") as! OtherVC
otherVc.delegate=self
self.presentVIEwController(otherVc,animated: true) { () -> VoID in
}
总结以上是内存溢出为你收集整理的swift的protocol全部内容,希望文章能够帮你解决swift的protocol所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)