您的位置:首页 > 移动开发 > IOS开发

iOS delegate 传值步骤

2016-03-17 20:17 399 查看
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{
      
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: