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

IOS跳转视图传参的几种方法

2015-10-19 08:23 399 查看
IOS视图间传参的方式

以下是iOS视图间传参几种方式:

1.属性传参;

2.委托delegate(协议);

3.notification(通知);

4.block方式;

场景一:A页面跳转到B页面

SecondViewController.h //第二个页面
@interface SecondViewController : UIViewController
@property(nonatomic,copy) NSString *flag;//在第二个页面提供属性
@end
<pre name="code" class="html"> //在第一个页面跳转页面并赋值
SecondViewController *secondController=[[SecondViewController alloc] init];
secondController.flag=@"我是flag";
[self.navigationController pushViewController:secondController animated:YES];



 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: