我的 .m 文件中的函数中有以下代码:
desc = [my executeFunction]; // desc is returned by executeFunction
data = [desc objectAtIndex:0]; // data is declared in the .h file
data2 = [desc objectAtIndex:1];
[myTextField setString:data]; // myTextField is connected to an NSTextView in IB
[myTextField setString:data2];
我应该如何写第四行和第五行?如何/在哪里发布数据和 data2?
最佳答案
你不知道。您尚未从选择器包含 alloc
、new
或 的方法接收到
或名称包含 data
或 data2
copyCreate
的函数,因此您不负责释放它们。
关于objective-c - 使用 NSString 变量设置 NSTextView 的文本,考虑引用计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2249177/