我有一个 View Controller ,允许我添加名称、图像和日期。名称和日期被发送回 TableView Controller 并显示。然后我有一个编辑 View Controller ,当填充时显示单元格被单击...
我的保存方法:
-(IBAction)save:(id)sender {
NSData *imageData = UIImagePNGRepresentation(_imageview.image);
[self.currentPlayer setValue:imageData forkey:@"playerPic"];
[self.delegate addPlayerViewControllerDidSave];
}
我的代表正在调用保存:&错误所以我不会粘贴该代码
我相信这是可行的,但我的问题是如何在编辑 View Controller 上显示该图像
我的姓名和日期信息已通过,但图片未通过
我有一个 UIImageView,我正在尝试类似的东西,但我知道这是两种不同的指针类型,不会起作用
-(void)viewDidLoad {
firstnameTextField.text = [self.currentPlayer playerName];
editImage.image = [self.currentPlayer playerPic];
}
任何帮助将不胜感激
最佳答案
您需要从 NSData 对象创建一个 UIImage,如下所示:
[UIImage imageWithData:[self.currentPlayer playerPic]]
关于ios - 从 NSData 检索图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21419303/