Hi all, I'm working on my first iPhone app and I ran into a problem. Here's what I got...
I have a Navigation-Based app where each cell in the table has a UILabel and a UIImageView. Tapping a cell goes to a ViewController where the data from the UILabel and UIImageView can be modified. In this ViewController there is a text field, a UIImageView and a Button which calls up the built-in ImagePickerController.
Whenever I add/modify an item and return to the TableView, the UILabel is showing the appropriate changes. However, I can't seem to get the image "out" of the ViewController and back to the TableView. I did some checking and it seems that the image is simply nil whenever I go back to the TableView.
Here's my code...
ViewController:
Code:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
imageView.image = image; //UIImageView in the ViewController is updated successfully
self.item.itemPic = image; //itemPic set. a check confirmed it's not nil
[picker dismissModalViewControllerAnimated:YES];
}
- (IBAction) updateName:(id) sender
{
self.item.itemName = self.itemNameTextField.text;
}
ItemCell:
Code:
- (void)setItem:(Item *)newItem
{
item = newItem;
self.itemNameLabel.text = newItem.itemName; //this works fine.
self.itemImageView.image = newItem.itemPic; //itemPic is nil
[self setNeedsDisplay];
}
Anybody have any ideas? ANY help would be greatly appreciated.