ios - 将解析数组分配给 UITextView

标签 ios objective-c xcode uitableview parse-platform

我已经成功地将我的解析数据字符串指向 UILabel,并让它们在 UITableViewController 上显示内容。

在我的 UITableView 单元格上,我还有一个 UITextView 来显示来自 Parse 的数组。这个数组叫做“Post_Description”。在 Storyboard 的单元格中,我为 UITextView 指定了 103 标签。

但是,当我运行这段代码时,我遇到了崩溃。

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI length]: unrecognized selector sent to instance 0x170239c60'

这是我为 UITextView 调用的代码:

    UITextView *postView = (UITextView*) [cell viewWithTag:103];
postView.text = [object objectForKey:@"Post_Description"];

enter image description here

Parse

最佳答案

这很好,因为在深入研究了一些 Material 后,我最终自己解决了这个问题。

首先您创建您的 UITextView 标识符并指向您的 UITextView 的单元格标签:

UITextView *myTextView = (UITextView*) [cell viewWithTag:100];

然后您在 Parse 中将一个 NSArray 分配给您的数组:

NSArray *myArray = [object objectForKey:@"MyArrayInParse"];

然后你像这样加入他们的婚姻:

[myTextView setText:[myArray objectAtIndex:[indexPath section]]];

这就是您在 Parse 中将数组显示到 UITextView 中的方式:)

关于ios - 将解析数组分配给 UITextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31506566/

相关文章:

cocoa - NSWindow,怎么不进行部分截图?

ios - 如果我从可重用单元格的 super View 中删除 UILabel,重用时如何重新初始化单元格中的 UILabel?

xcode - WebView 具有多个按钮以在同一页面中浏览文件

ios - 我应该如何访问存储在包含容器 View 的 View Controller 中的 IBOutlet? ( swift 4)

ios - 推送通知服务器端数据模型

ios - LocatinManager 的 iOS CLRegion 功能的最小半径

objective-c - 如何在没有手势的情况下以编程方式触发翻页转换?

php - 我如何在 html 中显示 pdf(响应/跨浏览器解决方案)

javascript - Cardova IOS 10. "Failed to load webpage with error: The URL can’ t被显示”

iphone - 有没有开源的动画库?