将解析数组分配给UITextView [英] Assigning Parse Array to UITextView

查看:99
本文介绍了将解析数组分配给UITextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地管理了将解析数据字符串指向UILabels,并使它们在UITableViewController上显示内容.

I've successfully managed pointing my Parse Data Strings to UILabels and having them display the content on a UITableViewController.

在我的UITableView单元上,我还有一个UITextView来显示来自Parse的数组.该数组称为"Post_Description".在Storyboard的单元中,我给UITextView设置了103的标记.

On my UITableView Cell I also have a UITextView to display an Array from Parse. This Array is called "Post_Description". Within my cell on Storyboard I have given my UITextView a tag of 103.

但是,当我运行这段代码时,我崩溃了.

However when I run this code, I'm getting a crash.

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

这是我为UITextView调用的代码:

Here is the code i am calling for the UITextView:

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

推荐答案

这很好,因为我在深入研究某些材料后最终自己搞清楚了.

This is good because I ended up figuring this out by myself after digging deep into some material.

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

First you create your UITextView identifier and point to the cell tag of your UITextView:

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

然后您在解析中将NSArray分配给您的数组:

Then you assign an NSArray to your Array in Parse:

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

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

Then you join them in marriage like so:

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

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

And that's how you display an Array in Parse, into a UITextView :)

这篇关于将解析数组分配给UITextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆