Top of the page
Close

This is a red error

This is a red error

This is a red error

Example of using NSMutableArray and addObject in Objective-C in XCode

Ondrej Rafaj on 2009.09.17 18:29:37

Example of using NSMutableArray and than reading all the variables back into the NSLog as a NSString.

NSMutableArray *myArray = [[NSMutableArray alloc] init];
[myArray addObject:@"First line"];
[myArray addObject:@"Second line"];
[myArray addObject:@"Third line"];
[myArray addObject:@"Fourth line"];
[myArray addObject:@"Fifth line"];


for (NSString *line in myArray) {
	// Results from NSLog are in the Console
	NSLog([NSString stringWithFormat:@"line: %@", line]);
}

Results from NSLog are in the Console, you can find this one by pressing "Apple key + Shift + R" or Run->Console

Ondrej Rafaj

Ondrej Rafaj

Independent iPhone developer @ ondrej-rafaj.co.uk

I am available to give you a free quote or start working on your project ... just give me a call or drop a line. Please find all my details on my portfolio site ondrej-rafaj.co.uk

Back to top Comment

Comments ... Why not to get involved!

We had to disable comments till the problem with spam will be solved, sorry for any inconvenience caused.

Back to top

IE SUCKS, DON'T USE IT :) Digg this page