Re: Getting Image from plist
Re: Getting Image from plist
- Subject: Re: Getting Image from plist
- From: Wayne Packard <email@hidden>
- Date: Fri, 01 Jul 2011 14:42:49 -0700
Hi,
What is stored in the "cover" object?
If it's the name of a file that is bundled with the app, you can use
cell.coverAuthor.image = [UIImage imageNamed:[[data objectAtIndex:index] objectForKey:@"cover"]];
If it's the name of a file stored on "disk" some place (e.g., the Application Support directory) you'll need to build up a string with the complete path for it using something like
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES).
Then pass that full path to [UIImage imageWithContentsOfFile:].
If it's an NSData object containing the actual image, you could use
[UIImage imageWithData:[[data objectAtIndex:index] objectForKey:@"cover"]];
wp
On Jul 1, 2011, at 1:55 PM, Fernando Aureliano wrote:
> Hi,
>
> I'm reading data from an plist, and I'm having problems for get the image.
>
> The code for text look like this:
>
> cell.auhorLabel.text = [[data objectAtIndex:index] objectForKey:@"author"];
>
> Works fine.
>
>
> The code to get a image em put in uiimageview look like this:
>
> cell.coverAuthor.image = [UIImage imageWithContentsOfFile:[data
> objectAtIndex:index] objectForKey:@"cover"];
>
>
> yeah, I know, this last line is strange.
>
> How is the right way?
>
>
> Thanks!
>
>
> --
> *Fernando Aureliano*
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden