#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
网友评论