IOS 界面传值

来源:互联网 发布:农村淘宝黄岩服务中心 编辑:程序博客网 时间:2024/05/02 08:47



关于界面传值

现在知道的一种方法就是

成员变量的方法, 在你要接受值的类.h 文件里面定义你需要传值的成员变量,

B.h

@property(nonatomic,copy) NSString *sname;

@property(nonatomic,assign) NSString *sno;



然后再跳转类里面 将值进行赋值 然后push方法进行跳转。

A.h


这个方法是按钮的Action

    EditViewController *aplBookshelfViewController=[[EditViewController alloc] init];

    //因为行号是NSInteger类型 所以要进行字符串的格式化处理。

    NSString *masg=[NSString stringWithFormat:@"IS-012%ld",indexPath.row];

    aplBookshelfViewController.sno=masg;

    aplBookshelfViewController.sname=textRow;

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

    

0 0