将数组填充到 TableView 中
在 tableView 中,我有以下内容:
NSDictionary *cat = [category objectAtIndex:indexPath.row];
cell.textLabel.text = [cat valueForKey:@"reference"];
这会使用 XML 文件中的数组内容填充 tableView。 还有另一个数组“数据”将内容打印到调试控制台,我想用此内容填充另一个视图。但我在用数据数组填充下一个视图时遇到很多麻烦。
NSLog(@"cellForRowAtIndexPath-- Reference:%@: Verse:%@", [cat valueForKey:@"reference"], [cat valueForKey:@"data"]);
didSelectRowAtIndexPath 方法如下所示:
Verse *vvc = [[Verse alloc] initWithNibName:@"VerseView" bundle:nil]; vvc.verses = [[category objectAtIndex:indexPath.row] valueForKey:@"verse"];
[self.navigationController pushViewController:vvc animated:YES];
[vvc release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
在下一个视图的 cellForRowAtIndexPath 中,我有以下内容:
NSDictionary *cat = [verses objectAtIndex:indexPath.row];
cell.textLabel.text = [cat valueForKey:@"data"];
我想要的是在 textView 中包含“数据”。
我不知道出了什么问题。任何帮助将不胜感激!
In a tableView I have the following:
NSDictionary *cat = [category objectAtIndex:indexPath.row];
cell.textLabel.text = [cat valueForKey:@"reference"];
This populates the tableView with the content of the array from an XML file.
There is another array “data” that prints out the content to the debug console and I want to populate another view with this content. But I am having lot of trouble populating the next view with the data array.
NSLog(@"cellForRowAtIndexPath-- Reference:%@: Verse:%@", [cat valueForKey:@"reference"], [cat valueForKey:@"data"]);
The didSelectRowAtIndexPath method looks like this:
Verse *vvc = [[Verse alloc] initWithNibName:@"VerseView" bundle:nil]; vvc.verses = [[category objectAtIndex:indexPath.row] valueForKey:@"verse"];
[self.navigationController pushViewController:vvc animated:YES];
[vvc release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
In the cellForRowAtIndexPath of the next view I have the following:
NSDictionary *cat = [verses objectAtIndex:indexPath.row];
cell.textLabel.text = [cat valueForKey:@"data"];
What I would like is to have the “data” in a textView.
I don’t know what’s wrong. Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论