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'

0

1 Answer 1

4

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

oneTextText = [oneTextText stringByAppendingString:[oneText objectAtIndex:1]]; 
Sign up to request clarification or add additional context in comments.

2 Comments

This one gets me all the time; You get used to it eventually and the reference docs are your friend! :-D
thanks a lot for the quick reply. i thought it only had to return on itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.