【发布时间】:2013-01-14 18:41:40
【问题描述】:
我有 2 个视图控制器:
- 索引
- 第二
在索引中,我有 2 个 textfield 和 button。
我填写这个文本字段并按“下一步按钮”到第二个视图,我需要使用数组“显示”这两个文本字段(稍后我将发送 JSON 数据)。
我怎样才能最好地实现?请帮忙!
最好的问候
伊万。
【问题讨论】:
标签: iphone ios xcode arrays xcode4.5
我有 2 个视图控制器:
在索引中,我有 2 个 textfield 和 button。
我填写这个文本字段并按“下一步按钮”到第二个视图,我需要使用数组“显示”这两个文本字段(稍后我将发送 JSON 数据)。
我怎样才能最好地实现?请帮忙!
最好的问候
伊万。
【问题讨论】:
标签: iphone ios xcode arrays xcode4.5
在Second 类中将@property 声明为textArray。然后在从Index 推送到Second 时,需要设置这个属性。
在Second.h 文件中,
@property(nonatomic, strong) NSArray *textArray;
在Index.m 文件中,
Second *aSecond = [[Second alloc] init];
aSecond.textArray = @[textField1.text, textField2.text];
//write code to push from Index to Second
现在在Second 类中,您可以将其用作aSecond.textArray[0] 和aSecond.textArray[1]
【讨论】: