从核心数据填充UITableViewCell的问题(Problem in filling UITableViewCell from Core Data)

编程入门 行业动态 更新时间:2024-10-20 11:33:19
核心数据填充UITableViewCell的问题(Problem in filling UITableViewCell from Core Data)

从Core Data获取数据后,我遇到问题。 我从获取的数据中填充了一个TableView,但TableView在其中显示了以下数据

(实体:Fortune; id:0x6549c40; data:)

有人可以告诉我我做错了什么吗? 以下是我用来填充TableViewCell的代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] autorelease]; Fortune *info = [fetchedObjects objectAtIndex:indexPath.row]; cell.textLabel.text = info.description; return cell;

}

Fortnue是我的托管对象类,描述是NSString类型的列。

问候。

I have a problem after the data being fetched from Core Data. I filled a TableView from the fetched data but the TableView shows the following data in it

(entity: Fortune; id: 0x6549c40 ; data: )

Can anybody tell me what I am doing wrong? Below is the code I used to fill TableViewCell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] autorelease]; Fortune *info = [fetchedObjects objectAtIndex:indexPath.row]; cell.textLabel.text = info.description; return cell;

}

Where Fortnue is my Managed Object Class and description is the column of type NSString.

Regards.

最满意答案

[object description]; 是一个返回实例描述,内存地址等等的默认方法。你不应该为NSManagedObject任何属性使用名称'description'。

[object description]; is a default method returning the description of the instance, memory address etc. You should not use the name 'description' for any of your properties of an NSManagedObject.

更多推荐

本文发布于:2023-07-23 18:34:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1235626.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:核心   数据   UITableViewCell   Problem   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!