 |
 |
|
 |
05-26-2009, 05:47 PM
|
#1 (permalink)
|
|
Registered Member
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 440
|
Display Image from Array in Custom Table Cell
I am trying to display an image in a custom table cell that I created in Interface Builder. Text works fine, but it crashes or errors when i try to display an image in my UIImageView. I've tried every variation I can think of. I'm guessing I've messed up something in one of these two areas of of my ViewController.m. The first image is named "AlbumArt1.png", and the key for it is called "Art".
Code:
- (void)viewDidLoad {
NSDictionary *row1 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Title 1", @"Title", @"1990", @"Year", @"AlbumArt1", @"Art", nil];
NSDictionary *row2 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Title 2", @"Title", @"2000", @"Year", @"AlbumArt2", @"Art", nil];
NSDictionary *row3 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Title 3", @"Title", @"2005", @"Year", @"AlbumArt3", @"Art", nil];
NSArray *array = [[NSArray alloc] initWithObjects:row1, row2, row3, nil];
self.albums = array;
[row1 release];
[row2 release];
[row3 release];
[array release];
Code:
NSUInteger row = [indexPath row];
NSDictionary *rowData = [self.albums objectAtIndex:row];
cell.titleLabel.text = [rowData objectForKey:@"Title"];
cell.yearLabel.text = [rowData objectForKey:@"Year"];
cell.artImage.image = [rowData objectForKey:@"Art"];
return cell;
I'm sure it's something bonehead, but I'm having a heck of a time sorting it out. Thanks for any assistance.
|
|
|
06-25-2009, 11:00 PM
|
#2 (permalink)
|
|
Registered Member
Join Date: May 2009
Posts: 25
|
I was litterally just going over this, it crashed on me as well when doing a similiar thing, I traced mine back to not having a file type on image, once I add .png to the end or .jpg etc it loaded up fine, and if it couldnt locate the image or match up one, say for instance i got the file extension wrong it simply just didn't display an image but kept running..
It may or may not help, still learning.. hope I could help..
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 479 |
| 36 members and 443 guests |
| acegames, Akshay Shah, baxtercr, beginer2007, danny8, eyefone, fede, gabacus, harikant_jammi, hc98br, ianian, Iphonica, jackson, jdavid, joelm, kikesantos, kilobytedump, m4r0ck, mcwhite, mgales, mobilesoftware, Mr Jack, mxstudios, NSeven, raees, raziiq, refreshe, riq, robertyang999, scalar, shweta13, supudo, theM, tin pot, wolfenberg |
| Most users ever online was 779, 05-11-2009 at 10:55 AM. |
» Stats |
Members: 21,478
Threads: 35,762
Posts: 156,660
Top Poster: smasher (2,448)
|
| Welcome to our newest member, m4r0ck |
|