简体   繁体   中英

Store NSMutableArray of custom objects in Core Data

I have a NSMutableArray full of a custom object called CHClipboardObject I need to save this array to core data so I can use it to populate a UITableView . I have looked around on how to do this and this is what I've got so far.

Create class called something like ArrayData with one property to hold the NSMutableArray

Serialize/conform to NSCoding my CHClipboardObject which I am not sure how to do.

What do I need to do after these steps?

I need to be able to delete objects in the array from the UITableView by swiping, which I have already implemented.

1) Set the type to "Transformable"

在此处输入图片说明

2) Implement methods

-(id)initWithCoder:(NSCoder *)aDecoder
-(void)encodeWithCoder:(NSCoder *)encoder

on your custom object

3) You are ready to go!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM