如何将数组从一个视图控制器传递到另一个? [英] How to pass an array from one view controller to another?

查看:93
本文介绍了如何将数组从一个视图控制器传递到另一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序。在其中我需要将一个数组从一个视图控制器传递到另一个视图控制器。

I'm developing an application. In it I need to pass an array from one view controller to another view controller.

我该怎么做?

推荐答案

你可以通过在第二个viewcontrollers .h文件中定义一个数组属性来实现,如:

you can do it by defining an array property in second viewcontrollers .h file like:

@interface SecondViewController : UIViewController 
@property(nonatomic, strong)NSArray *array;
@end

现在在FirstViewconrtoller中传递它

Now in FirstViewconrtoller just pass it

SecondViewController *controller = [[SecondViewController alloc]....]
controller.array = yourArray.//the array you want to pass

这篇关于如何将数组从一个视图控制器传递到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆