问题描述
我在FirstViewController类中有一个NSMutable数组,我想将该数组传递给SecondViewController类。我想在SecondViewController类中使用它。我正在使用ARC在Xcode 4.2.1中这样做...我怎么能......?设置属性时我想要使用的属性是什么...(或者)使用Appdelegate文件解释我...
有两种方法可以做到这一点。
1:在appdelegate中为NSMutableArray创建一个属性,在FirstViewController中设置数组的值并在SecondViewController中检索值。
2:在SecondViewController中为NSMutableArray创建一个属性,并为FirstViewController调用此属性,但调用SecondViewController的对象,并通过FirstViewController的secondViewController对象引用调用该属性。 p>
I have an NSMutable Array in FirstViewController class, I want to Pass that array to SecondViewController class. And I want to use that in SecondViewController class. I am doing this in Xcode 4.2.1 with ARC... How can I...? and what are the attributes i want to use when setting property... (OR) Explain me using Appdelegate files also...
There are two ways to do this.
1: Make a property for NSMutableArray in appdelegate, set the value for array in FirstViewController and retrieve value in SecondViewController.
2: Make a property for NSMutableArray in SecondViewController, and call this property for FirstViewController but making the object of SecondViewController, and calling the property via object reference of secondViewController from FirstViewController.
这篇关于iPhone中从一个类到另一个类的NSMutable数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!