views:

163

answers:

2

DetailsViewController.h

{
 UIImageView *Image;
}

@property(retain, nonatomic) IBOutlet UIImageView* Image;

DetailsViewController.m

 - (void)viewDidLoad {
    [super viewDidLoad];
 self.Title.text = location.title;
 self.desc.text = location.description;

this is the code to pull data from plist whenever user select a row in the uitableview..so the problem i am having now is how should i do it if i wan it to display an image?can't seems to get it after a few attempts..greatly appreciate!

+1  A: 

if you are looking for just the way to display an image, it is simple.

on Interface Builder,

  1. make Image View
  2. make connection between 1 and Outlet
  3. set the image path (short cut : Command + 1)
cappuccino
+1 for only having 1 reputation
willcodejavaforfood
+1  A: 

If you want to load this image into a UIImageView as suggested by cappucino, setup an IBOutlet like this so you have something to connect it to.

// in your header (.h) file in the interface definition
IBOutlet UIImageView *myIBImage;

// and at the bottom with your property declarations
@property (nonatomic, retain) UIImageView *myIBImage;

Also synthesize it at the top of you implementation file (.m)

@synthesize myIBImage;

Then in Interface Builder make the connections like this http://vimeo.com/3780487

Once connected, you can load the image into memory and set it to the view for your UIImageView.

// load an image from the bundle's path into memory
NSString* tmpStr = @"/myImage.png";
[myIBImageView setImage:[UIImage imageNamed:tmpStr]];

That's it. Who said iPhone coding is hard? (Yes it is tricky, but you'll do it so often you'll hardly notice!) :D

crunchyt