iOS delegate 传值步骤

来源:互联网 发布:生产看板管理系统 源码 编辑:程序博客网 时间:2024/06/05 19:53

iOS  delegate 传值步骤

 A.h

@protocol  MyDelegate

- (void )mjFuncWithString:(NSString*)str;

@end

@interface MyViewController :UIViewController

@property (assign)id<MyDelegate> delegate;

@end


A.m

 [self.delegatemjFuncWithString:self.t.text];


B.h

@interface ViewController :UIViewController<MyDelegate>


B.m

 MyViewController * svc=[[MyViewControlleralloc]initWithNibName:@"MyViewController"bundle:[NSBundlemainBundle]];

    svc.delegate=self;

    [selfpresentViewController:svc animated:YEScompletion:nil];


//实现方法

-(void)mjFuncWithString:(NSString*)str{

      

}


0 0
原创粉丝点击