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{
}
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{
}
相关文章推荐
- iOS开发集成百度地图
- iOS 直接页面跳转与返回
- IOS 证书申请
- iOS tableView 步骤
- iOS alert sheet 样例
- iOS开发系列--通讯录、蓝牙、内购、GameCenter、iCloud、Passbook系统服务开发汇总
- iOS开发-Git命令及操作
- 【iOS学习】十、利用背景色解决页面跳转卡顿
- iOS之06-三大特性之继承
- 【iOS学习】九、数据获取与界面跳转传值
- 41.影响iOS6与iOS7屏幕适配的参数和因素
- ios 脚本打包demo
- iOS -- 处理推送消息
- 【iOS】判断苹果的设备是哪种
- 【iOS】获取项目名和版本号
- IOS 渐变的图层,CAGradientLayer
- iOS开发之按照模型某一属性排序
- IOS 杂笔- 6(KVC-KVO)
- IOS 杂笔-5(NSTimer极浅析)
- IOS 杂笔-4(属性与成员变量的区别)