2010-02-23 102 views
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); 

爲什麼上面的代碼不能打印'Lenght.png'?作爲[arraySystem objectAtIndex:[countImage intValue]]等於「Lenght」 只會打印「Lenght」級聯字符串

回答

4

把「oneTextText =」呼叫stringByAppendingString的時候,它應該是:

oneTextText = [oneTextText stringByAppendingString:[oneText objectAtIndex:1]]; 
+0

這一次讓我所有的時間;你最終習慣它,參考文檔是你的朋友! :-D – 2010-02-23 14:55:37

+0

非常感謝您的快速回復。我認爲它只能回到自己身上。 – user265961 2010-02-23 15:45:47