Hello,
Apologies for my very beginner question, but I've just been trying to optimise some old code and I'm having some problems.
My question is: is it possible to initialise new objects inside another object initialisation? For example, I've been doing this:
Is there a way to init objects for the array inside the array's initialisation? For example:
I am just finding it very annoying with NSArrays and NSDictionary's that I can't (or really, don't know how) to set up the array/dict and create the variables for the array/dict inside that declaration.
I hope this makes sense...any help much apprecaited.
Apologies for my very beginner question, but I've just been trying to optimise some old code and I'm having some problems.
My question is: is it possible to initialise new objects inside another object initialisation? For example, I've been doing this:
Code:
NSString *bob = @"bob";
NSURL *jeff = [NSURL urlWithString:@"http://bob.com"];
NSArray *namesAndSites = [NSArray arrayWithObjects: bob, jeff];
Is there a way to init objects for the array inside the array's initialisation? For example:
Code:
NSArray *namesAndSites = [NSArray arrayWithObjects: [I]NSString mystring = whatever, NSURL urlWithString = whatever];[/I]
I am just finding it very annoying with NSArrays and NSDictionary's that I can't (or really, don't know how) to set up the array/dict and create the variables for the array/dict inside that declaration.
I hope this makes sense...any help much apprecaited.