设为首页 加入收藏

TOP

iOS开发之OC与swift开发混编教程,代理的相互调用,block的实现。OC调用Swift中的代理, OC调用Swift中的Block 闭包(五)
2019-08-31 00:22:13 】 浏览:142
Tags:iOS 开发 swift 教程 代理 相互 调用 block 实现 Swift Block 闭包
, for: .normal)  
  •         pushButton?.setTitle("push", for: .normal)  
  •         pushButton?.frame = CGRect.init(x: 50, y: 250, width: 200, height: 50)  
  •         pushButton?.layer.borderColor = UIColor.black.cgColor  
  •         pushButton?.layer.borderWidth = 1.0  
  •         pushButton?.addTarget(self, action: #selector(pushAction), for: .touchUpInside)  
  •         self.view.addSubview(pushButton!)  
  •           
  •     }  
  •       
  •     func popAction() -> Void {  
  •           
  •         if editorDelegate != nil {  
  •             editorDelegate?.editTextField((textField?.text)!)  
  •         }  
  •           
  •         if ((self.myEidtorBlock) != nil){  
  •             self.myEidtorBlock!((textField?.text!)!)  
  •         }  
  •           
  •         self.navigationController?.popViewController(animated: true)  
  •     }  
  •       
  •       
  •     func pushAction() -> Void {  
  •         let three = ThreeViewController.init()  
  •         self.navigationController?.pushViewController(three, animated: true)  
  •           
  •     }       
  •     2.2.3   在oc类中viewcontroller.m 文件中实现SecondviewController.swift的相关代理与闭包(block). 代码如下:
       
    [objc]  view plain  copy
     
    1. #import "ViewController.h"  
    2. #import "OcOrSwiftTwo-swift.h"  
    3.   
    4. @interface ViewController ()<EditTextFieldDelegate>  
    5. @property (nonatomic, strong) UITextField *showTextField;  
    6. @propert
    首页 上一页 2 3 4 5 6 下一页 尾页 5/6/6
    】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
    上一篇完整代理的简单实现 下一篇【OC底层】KVO原理

    最新文章

    热门文章

    Hot 文章

    Python

    C 语言

    C++基础

    大数据基础

    linux编程基础

    C/C++面试题目