美文网首页iOS学习笔记
页面传值black方法

页面传值black方法

作者: 金牛忘忧 | 来源:发表于2016-06-26 15:45 被阅读0次

    #import<UIKit/UIKit.h>

    @interfaceViewController :UIViewController

    @property(weak,nonatomic)IBOutletUILabel*label1;

    @end

    //

    //ViewController.m

    //页面传值black方法1

    #import"ViewController.h"

    #import"BaesViewController.h"

    @interfaceViewController()

    @end

    @implementationViewController

    - (void)viewDidLoad {

    [superviewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.

    }

    - (IBAction)buttonAction1:(UIButton*)sender {

    BaesViewController*baesCtr = [[BaesViewControlleralloc]init];

    baesCtr.sdf=^(NSString*xc){

    self.label1.text= xc;

    };

    [selfpresentViewController:baesCtranimated:YEScompletion:^{

    }];

    }

    @end

    //

    //BaesViewController.h

    //页面传值black方法1

    //

    #import<UIKit/UIKit.h>

    typedefvoid(^trandf)(NSString*);

    @interfaceBaesViewController :UIViewController

    @property(copy,nonatomic)trandfsdf;

    @property(weak,nonatomic)IBOutletUITextField*text1;

    @end

    //

    //BaesViewController.m

    //页面传值black方法1

    //

    #import"BaesViewController.h"

    @interfaceBaesViewController()

    @end

    @implementationBaesViewController

    - (void)viewDidLoad {

    [superviewDidLoad];

    // Do any additional setup after loading the view from its nib.

    }

    - (IBAction)buttonAction2:(UIButton*)sender {

    [selfdismissViewControllerAnimated:YEScompletion:^{

    //self.sdf(_text1.text);

    }];

    _sdf(_text1.text);

    }

    @end

    相关文章

      网友评论

        本文标题:页面传值black方法

        本文链接:https://www.haomeiwen.com/subject/blaadttx.html