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];

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.