0

I wish to be able to access this array in any sub in my secondviewcontroller, were do i add this coding to make it accessible via every sub

    NSMutableArray *YoutubeArray;
    YoutubeArray = [[NSMutableArray alloc] init];
user393273
  • 1,430
  • 5
  • 25
  • 48

1 Answers1

1

Create a property in the interface.

interface (.h file):

NSMutableArray *_youtubeArray;

@property(nonatomic,retain)NSMutableArray *  youtubeArray;

implementation (.m file):

@synthesize youtubeArray=_youtubeArray;


//in viewDidLoad/initwith...
self.youtubeArray = [[NSMutableArray alloc] init];

Alternatively, and for more scope Use a singleton structure

Community
  • 1
  • 1
Luke Mcneice
  • 3,012
  • 4
  • 38
  • 50