Still attempting to grasp iPhone programming and have come across a problem. I have an NSMutableArray within a class that stores the text value of each cell that is chosen/clicked on. In another view, i’d like to populate another table view with the array that was formed earlier. However, how do I go about accessing this array (which is a property in View1) from View2.
Will the array still be filled with the strings if I go to another view? Or does this require a sqLite DB or something along those lines to maintain persistence?
I have tried initializing another NSMutableArray with the contents of the array from View1, but this doesn’t seem to be right:
//View2.h
- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *savedExercise = [Create workout];
}
Any help would be much appreciated.
If you create view2 from view1, a common pattern is to create another init method, so when you create view 2, you would call
where data is your array.
In View2, you would have
where dataProperty is a property on View2.