//
// ViewController.m
// block传值
//
// Created by mac on 16/6/16.
// Copyright © 2016年 JDYang. All rights reserved.
//
#import "FirstViewController.h"
#import "SecondViewController.h"
@interface FirstViewController ()
@end
@implementation FirstViewController
- (void)viewDidLoad {
[super viewDidLoad];
//创建按钮
UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
btn.center = self.view.center;
btn.backgroundColor = [UIColor redColor];
[btn setTitle:@"入栈" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(push:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
//入栈
-(void)push:(UIButton *)sender{
SecondViewController *secondVC = [[SecondViewController alloc]init];
[self.navigationController pushViewController:secondVC animated:YES];
//接收回传的值
[secondVC returnValue:^(NSString *text) {
NSLog(@"%@",text);
}];
}
@end