NSArray arrayByAddingObject
Returns a new array that is a copy of the receiving array with a given object added to the end.
- (NSArray *)arrayByAddingObject:(id)anObject
Parameters
anObject
An object.
Return Value
A new array that is a copy of the receiving array with anObject added to the end.
Discussion of [NSArray arrayByAddingObject]
If anObject is nil, an NSInvalidArgumentException is raised.
NSArray arrayByAddingObject example.
NSArray *oldArray;
NSArray *newArray;
newArray = [oldArray arrayByAddingObject:obj];
[oldArray release];
NSArray *newArray;
newArray = [oldArray arrayByAddingObject:obj];
[oldArray release];
Example of [NSArray arrayByAddingObject].
NSArray * array = [NSArray array];
for ( int i = 1 ; i <= 100 ; i ++ )
array = [array arrayByAddingObject:[NSNumber numberWithInt:i]];
[array retain];
for ( int i = 1 ; i <= 100 ; i ++ )
array = [array arrayByAddingObject:[NSNumber numberWithInt:i]];
[array retain];
NSArray arrayByAddingObject example.
[...]
cc8* recipient = state.GetValue < cc8* >( 1, "" );
cc8* subject = state.GetValue < cc8* >( 1, "" );
cc8* message = state.GetValue < cc8* >( 1, "" );
[...]
NSArray* to = [[ NSArray alloc ] arrayByAddingObject:[[ NSString alloc ] initWithUTF8String:recipient ]];
cc8* recipient = state.GetValue < cc8* >( 1, "" );
cc8* subject = state.GetValue < cc8* >( 1, "" );
cc8* message = state.GetValue < cc8* >( 1, "" );
[...]
NSArray* to = [[ NSArray alloc ] arrayByAddingObject:[[ NSString alloc ] initWithUTF8String:recipient ]];