NSMutableString不会附加

问题描述

[string appendString:@\"\"];
((appdelegete *)[UIApplication sharedApplication].delegate).salesReceipt.old = [string ];
我想将我所有的元素添加到要收集其数据的
NSMutableString
字符串中。最好的方法是什么?在我的appdelegate类中有一个
NSMutableString
,我将在其中存储
NSMutableString
中的所有元素     

解决方法

        
NSMutabelString* string = [[NSMutabelString alloc] initWithCapacity:2]
[string appendString:@\"My String \"];
[string appendString:@\"\"];
//Now you need to access your NSMutableArray from Delegate add add the string.
 NSMutableArray* myArray = ((appdelegete *)[UIApplication sharedApplication].delegate).salesReceipt.items ;
[myArray addObject:string];
    

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...