分配数组到UITextView
我成功地pipe理指向我的parsing数据string到UILabels,并让他们在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"];
这是很好的,因为我在深入研究一些材料后,自己弄清楚了这一点。
首先你创build你的UITextView标识符并指向你的UITextView的单元格标签:
UITextView *myTextView = (UITextView*) [cell viewWithTag:100];
然后你分配一个NSArray到你的分析数组中:
NSArray *myArray = [object objectForKey:@"MyArrayInParse"];
那么你就像这样结婚:
[myTextView setText:[myArray objectAtIndex:[indexPath section]]];
这就是你如何显示在parsing数组,到UITextView 🙂