将数组填充到 TableView 中

发布于 2024-10-10 00:20:19 字数 1034 浏览 0 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文