标签:
1、用法1 传值
B页面向A页面反向传值
在B.h中 声明一个block属性
@property(nonatomic,copy)void (^myBlock)(NSString *t);
在b.m中
- (IBAction)button:(id)sender {
self.myBlock(@"fdslfjdslfjsdlk");
[self dismissViewControllerAnimated:YES completion:nil];
}
在A.m中
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewControllerB *vc = [sb instantiateViewControllerWithIdentifier:@"vcm"];
vc.myBlock = ^(NSString *st){
[self.label setText:st];
};
[self presentViewController:vc animated:YES completion:nil];
标签:
原文地址:http://www.cnblogs.com/huoxingdeguoguo/p/4862855.html