ios - 如何获取数组的内容以显示在 uitextfield 上

标签 ios objective-c nsarray uitextview

我试图让数组的内容显示在 uitextfield 上。

这是我的代码:

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

NSString * resultConditions = [arrayConditions description];

//conditionsDeal 是 uitextfield self.conditionsDeal.text = resultConditions;

条件是从这样的 url 中提取的:

"results": [
{
  "conditions": [
    "Il coupon è valido per soggiorni fino al...",
    "I coupon sono cumulabili, possibilità...",
    "Coupon non cumulabile con altre promozioni...",
  ],
  "deadline": "2013-11-27T22:59:59.000Z",

目前我的 uitextview 中唯一显示的是:

enter image description here

我需要删除 ( ( ) ) 括号并整齐地格式化它。

谢谢你的帮助

最佳答案

你想像这样连接数组中的所有字符串:

self.conditionsDeal.text = [arrayConditions[@"conditions"] componentsJoinedByString:@"\n"];

关于ios - 如何获取数组的内容以显示在 uitextfield 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14341256/

相关文章:

ios - iOS模拟器没有当前位置吗

ios - 如何将数据传递给使用 instantiateViewControllerWithIdentifier 创建的 ViewController?

ios - 在iOS中使用C从项目目录获取文件路径

ios - 更改build设置以编译 SQLCipher 后 FMDB 类出现 ARC 错误

iphone - 获取textview的第一句话

ios - 不同的初始 View Controller

objective-c - Objective-C : Adding Loading View to View Controllers

ios - 搜索 NSDictionary 的 NSArray(其中包含 NSDictionary 的 NSArray,重复)

objective-c - 从 NSMutableArray 检索 NSDictionary

ios - 比较/查找两个 NSArray 并获得正确的值