2

我有一个我想在 uitextview 中拥有的数组。这就是它当前的显示方式。如何删除 ( ( ) ) 的?

这是一个屏幕截图

在此处输入图像描述

这是我的代码:

NSArray *arrayConditions = [[NSArray alloc] initWithObjects:[item objectForKey:@"conditions"], nil];

NSString * resultConditions = [arrayConditions description];

self.conditionsDeal.text = resultConditions;

NSLog(@"conditions are %@", [item objectForKey:@"conditions"]);

谢谢你的帮助

4

3 回答 3

3
NSArray *arrayConditions = [[NSArray alloc] initWithObjects:[item objectForKey:@"conditions"], nil];

// change this line only for the concatenation
NSString * resultConditions = [arrayConditions componentsJoinedByString:@"\n"];

self.conditionsDeal.text = resultConditions;

// this line always provides you the result of the '-description' method of the 'NSArray'
NSLog(@"conditions are %@", [item objectForKey:@"conditions"]);
于 2013-01-18T13:07:02.300 回答
2
NSMutableString *textViewText = [NSMutableString string];

for (NSString *str in arrayConditions)
    [textViewText appendFormat:@"%@\n", str];
self.conditionsDeal.text = textViewText;
于 2013-01-18T12:09:24.210 回答
0
  1. 将该数组转换为 NSMutableString。
  2. 用“,”或空格分隔该字符串并将其写入 UITextView。
于 2013-01-18T12:20:01.200 回答