2010-02-23 103 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