Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

iphone - How to pass an array from one view controller to another?

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

How can I do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

Now in FirstViewconrtoller just pass it

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...