gpt4 book ai didi

ios - 如何在 UITextView 中显示 NSArray

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:31:09 25 4
gpt4 key购买 nike

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

这是截图

enter image description here

这是我的代码:

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

NSString * resultConditions = [arrayConditions description];

self.conditionsDeal.text = resultConditions;

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

谢谢你的帮助

最佳答案

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"]);

关于ios - 如何在 UITextView 中显示 NSArray,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14398522/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com