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

IOS顺时针传值-模型传值

2015-10-14 11:57 183 查看
页面之间如果是顺时针传值的话(A->B),直接在跳转的时候传值即可。举例说明,模型传值

1、首先在B页面里面创建一个接口的Model,需要饮用model的头文件

#import <UIKit/UIKit.h>

#import "ReceivingInfoModel.h"

@interface ReceivesAddressController : UIViewController

@property(nonatomic,strong)ReceivingInfoModel* model;

@end

2、在A页面切换的地方进行传值。将A页面中DataArray可变数组中的DataArray[Btn.tag-500]数组赋值给model。

#pragma mark - 修改收货地址按钮事件

-(void)ToEditInfo:(UIButton *)Btn{

ReceivesAddressController *receivesVc = [[ReceivesAddressController alloc] init];

receivesVc.model =DataArray[Btn.tag-500];

[self.navigationController pushViewController:receivesVc animated:YES];

}

3、在B页面中将model里面的值赋值给对应的控件即可

_textField1.text=self.model.name;

_textField2.text=self.model.phoneNumber;

_textField3.text=self.model.receive_area;

_textField4.text=self.model.receive_street;

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