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:

  1. singleton
  2. passing data between viewcontrollers
  3. 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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -