Ios 如何在UITextView中显示NSArray

Ios 如何在UITextView中显示NSArray,ios,objective-c,nsarray,uitextview,Ios,Objective C,Nsarray,Uitextview,我有一个数组,它是我想在uitextview中使用的。这就是它当前的显示方式。如何删除(())的 这是一个截图 这是我的密码: NSArray *arrayConditions = [[NSArray alloc] initWithObjects:[item objectForKey:@"conditions"], nil]; NSString * resultConditions = [arrayConditions description]; self.conditionsDeal.t

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

这是一个截图

这是我的密码:

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

NSString * resultConditions = [arrayConditions description];

self.conditionsDeal.text = resultConditions;

NSLog(@"conditions are %@", [item objectForKey:@"conditions"]);
谢谢你的帮助

NSMutableString *textViewText = [NSMutableString string];

for (NSString *str in arrayConditions)
    [textViewText appendFormat:@"%@\n", str];
self.conditionsDeal.text = textViewText;
  • 将该数组转换为NSMutableString
  • 用“,”或空格分隔该字符串,然后将其写入UITextView

  • 换句话说。。您想让我们为您提供更好的数组显示格式吗?
    NSString*\u string=[\u您的数组组件通过字符串连接:@“\n”];//或者任何其他字符串
    重复的问题-componentsJoinedByString:方法?:)有什么问题对于新手(me),可以将输出从每行一项更改为通过逗号分隔项,将@“\n”更改为@”,“(谢谢holex)
    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"]);