How can I create an NSArray with values prepopulated.
That is to say:
NSArray *name=[NSArray alloc];
// insert these values: raju, biju.ramu
Thanks and regards from raju..
How can I create an NSArray with values prepopulated.
That is to say:
NSArray *name=[NSArray alloc];
// insert these values: raju, biju.ramu
Thanks and regards from raju..
Use the NSArray initWithObjects method, remembering to put nil in as the last value:
NSArray *names = [[NSArray alloc] initWithObjects:@"raju", @"biju", @"ramu", nil];
If you need to modify an existing array, You must use NSMutableArray
NSMutableArray *name=[[NSMutableArray alloc]init];
[name addObject: @"raju"];
[name addObject: @"biju"];