iOS delegate 传值步骤
A.h
@protocol MyDelegate
- (void )mjFuncWithString:(NSString*)str;
@end
@interface MyViewController : UIViewController
@property (assign) id<MyDelegate> delegate;
@end
A.m
[self.delegate mjFuncWithString:self.t.text];
B.h
@interface ViewController : UIViewController<MyDelegate>
B.m
MyViewController * svc=[[MyViewController alloc]initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
svc.delegate=self;
[self presentViewController:svc animated:YES completion:nil];
//实现方法
-(void)mjFuncWithString:(NSString*)str{
}