Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-21-2009, 10:39 PM   #1 (permalink)
Errornix
Registered Member
 
Join Date: Jun 2009
Posts: 8
Errornix is on a distinguished road
Default Help Retaining UIImage

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.
Errornix is offline   Reply With Quote
 

» Advertisements
» Online Users: 445
18 members and 427 guests
baja_yu, buggen, coolman, evilmatt10, givensur, guusleijsten, Kieren Harrold, networ, pabloruiz55, pochuang, QuantumDoja, Sami Gh, scubadivingfool, Speed, teebee74, TheStalker, thestojkovic, za1407
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,636
Threads: 94,101
Posts: 402,819
Top Poster: BrianSlick (7,990)
Welcome to our newest member, samdanielblr
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:45 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.