Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:29:49+00:00 2026-05-24T04:29:49+00:00

I’m trying to read a reference to an image file out of a plist

  • 0

I’m trying to read a reference to an image file out of a plist and make the image display in a detail view. although I can do this for my table view layout, I’m having trouble doing this with my DetailViewController nib file. I’m hoping someone can help me fix the problem and explain to me where I’m going wrong. What follows with the code is my explanation of what I THINK I’m doing. If you could explain to me what I’m doing wrong as much as show me what I should be doing, I’d really appreciate it. I’m trying to learn as much as trying to make things work.

I think the problem resides in two places. The first is my didSelectRowAtIndexPath method:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //Get the dictionary of the selected data source.
    NSDictionary *dictionary = [[[self.localSites objectAtIndex:indexPath.section]objectForKey:@"rowData"] objectAtIndex:indexPath.row];

    TableDetailViewController *controller = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:[NSBundle mainBundle]];  

    controller.title = [dictionary objectForKey:@"Location"];
    controller.dText = [dictionary objectForKey:@"details"];

    // THIS IS WHERE THE PROBLEM IS
    NSString *tiny = [dictionary objectForKey:@"thumb"];
    controller.mainImage  = [UIImage imageNamed:tiny];

    [self.navigationController pushViewController:controller animated:YES];

    [controller release];
}

In the code above marked //THIS IS WHERE I THINK THE PROBLEM IS, What I’m trying to do is grab the reference to the image contained in string in the plist and use the reference to get the image. This approach works fine in my cellForRowAtIndexPath method where I use it to populate the left hand side of the table with thumbnail images referred to from my plist.

In the above code mainImage refers to a string I’ve tried to connect to a UIImageView outlet in my TableDetailViewController.xib through my TableDetailViewController.m file as below. This is where I think Problem number two is:

- (void)viewWillAppear:(BOOL)animated 
{
    [super viewDidLoad];

    //This Bit says that the text contained in UITextView blurb is the string dText, which is used in my didSelectRowAtIndex method
    blurb.text = dText;

    //This is where I try to do the same thing by saying that UIImageView topImage is the NSString mainImage which I use in my didSelectRowAtIndex method
    topImage.image =  mainImage;    
}

My Logic was that topImage is a UIImageView and mainImage is the string containing the image view which in my didSelectRowAtIndex method I pass the value of the key ‘thumb’ contained in my plist file.

However the above throws up warnings. Can anyone help?

Thanks for taking the time to read.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:29:51+00:00Added an answer on May 24, 2026 at 4:29 am

    Ok, I managed to work this out. My mistake was to declare the pointer mainImage as a NSString instead of as a UIImage. I did this because in the .plist I am using the name of the image is contained within a string. I realised though that as I change this string for the .png file of the same name in my didSelectRowAtIndexPath method, by the time I’m passing it to mainImage it is no longer a string I’m passing, it’s an image. Sorted! An easy mistake for a newb like me to make. Thought I should post as I’m sure I wont be the only one who makes this mistake.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
i want to parse a xhtml file and display in UITableView. what is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.