I have a view controller that allows me to add a name, image, and date..the name and date are sent back to the table view controller and displayed..I then have a edit view controller that shows when a populated cell is clicked...

my save method:

-(IBAction)save:(id)sender {
  NSData *imageData = UIImagePNGRepresentation(_imageview.image);
  [self.currentPlayer setValue:imageData forkey:@"playerPic"];

 [self.delegate addPlayerViewControllerDidSave];
} 

my delegate is calling the save:&error so i wont paste that code

I believe this is working but my question is how do I have that image display on the edit view controller

my name and date information is passing but not the image

I have a UIImageView and I am attempting something like that but I understand those are two different pointer types and wont work

 -(void)viewDidLoad {
 firstnameTextField.text = [self.currentPlayer playerName];
 editImage.image = [self.currentPlayer playerPic];

 }

any help would be appreciated

有帮助吗?

解决方案

You need to create a UIImage from your NSData object as follows:

[UIImage imageWithData:[self.currentPlayer playerPic]]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top