tags:

views:

48

answers:

1
NSMutableArray * oneText = [[NSMutableArray alloc] init];
[oneText addObject:[arraySystem objectAtIndex:[countImage intValue]]];
[oneText addObject:@".png"];
NSString *oneTextText=[oneText objectAtIndex:0];
[oneTextText stringByAppendingString:[oneText objectAtIndex:1]];
NSLog(oneTextText);

Why can't the above code print 'Lenght.png'? as [arraySystem objectAtIndex:[countImage intValue]] is equal to 'Lenght' it prints only 'Lenght'

+4  A: 

put a "oneTextText=" when calling stringByAppendingString, it should be:

oneTextText = [oneTextText stringByAppendingString:[oneText objectAtIndex:1]]; 
ahmet emrah
This one gets me all the time; You get used to it eventually and the reference docs are your friend! :-D
widgisoft
thanks a lot for the quick reply. i thought it only had to return on itself.