ios - Copying of NSMutableArray from one viewcontroller to another viewcontroller? -
i have 1 nsmutablearray
in firstviewcontroller
declared firstarray
. want copy secondarray
firstarray
.
in secondviewcontroller,
self.firstviewcontroller.firstarray = self.secondarray;
when attempt nslog
firstarray
.count firstviewcontroller
, display 0. should have 2 objects in array
anyone can advise on this?
you can choose 1 of solutions:
- singleton
- passing data between
viewcontrollers
- delegation
you can find info need right here: https://stackoverflow.com/a/9736559/1578927
singleton example:
static mysingleton *sharedsingleton; + (void)initialize { static bool initialized = no; if(!initialized) { initialized = yes; sharedsingleton = [[mysingleton alloc] init]; } }
Comments
Post a Comment