1
該代碼應該保存核心數據。該圖像存儲在它自己的實體,喜歡另一個實體(關係)核心數據中的UIImage
NSEntityDescription *imageEntity = [ NSEntityDescription insertNewObjectForEntityForName:kImage inManagedObjectContext:self.context];
[imageEntity setValue:self.image forKey:kPicture];
[newPerson setValue:imageEntity forKey:kPicture];
NSError *error;
if (![self.context save:&error]) {
NSLog(@"Whoops, couldn't save new associate: %@", [error localizedDescription]);
}
在這裏,我試圖把它找回來,把它放在一個的UIImageView上的自定義單元格
Person *crt = [self.fetchController objectAtIndexPath:indexPath];
cell.name.text = crt.name;
Image *img = crt.picture;
cell.image.image = img.picture;
這隻第一次添加圖片時工作...重新啓動應用程序後圖像不再顯示..爲什麼?它設置爲可變形的屬性
的奇怪的是,我做這個別的地方也(保存圖像(小PNG))的可轉換......還有它的作品... – user1028028