我已经成功地将我的解析数据字符串指向 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"];
最佳答案
这很好,因为在深入研究了一些 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/