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

  • Home
  • SEARCH
  • 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 6974799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:17:04+00:00 2026-05-27T17:17:04+00:00

I have a UITableView with some cells. When a cell is tapped, I set

  • 0

I have a UITableView with some cells. When a cell is tapped, I set a string variable called Index to the index of the cell that was tapped. I have verified that this is working with an NSLog of Index from my UIImageView’s controller. Now, what I’m trying to do is set the image of a UIImageView to an image corresponding to the cell tapped (i.e. a different image for each cell). The way I’m trying to do this (it doesn’t work) is with this code in my UIImageView’s controller’s ViewDidLoad method:

if ([[TableViewController alloc] Index] isEqualToString:@"0"]) {
   Display.image = [UIImage imageNamed:@"0.jpg"]; 
}  

‘Display’ is the name of my UIImageView.
Is this code correct? If it is, where should I put it so that when I tap the first cell my UIImageView initialises with the image called “0.jpg”?

  • 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-27T17:17:05+00:00Added an answer on May 27, 2026 at 5:17 pm

    Is your image view controller already visible (loaded) on the same screen as your table view, or are you pushing a new image view controller for each cell tap on the table view? This makes a huge difference in how to approach this. If you are doing the former, using viewDidLoad won’t work because the view is already loaded. You’ll have to write a method to change the image, like:

    -(void)changeImage:(NSString *)imageName {
        Display.image = [UIImage imageNamed:imageName];
    

    If you’re pushing a new image view each time, then you’ll want to make an instance variable in the image view class and put this in your table view didSelectRow… method:

    myImageView.imageName = [NSString stringWithFormat:@"%d.jpg", indexPath.row];
    //now push your view
    

    It might be helpful to post more of your code so we can see the situation with how the views are loaded.

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

Sidebar

Related Questions

I have a UITableView cell that is going to have a variable size depending
I have a UITableView with some cells in it that have people's names. When
I have a UITableView with some cells, where (for example) the first cell is
I have a working UITableView filled with some options for my app, and i
I have a UITableView that displays single large images in each cell. The names
I have a uitableview that loads fairly large images in each cell and the
So, I have this UITableView . It's in an iPad application. Some of the
I have a UITableView that is re-using cells when the user scrolls. Everything appears
I have a UITableView subclass and a UITableViewCell subclass that I'm using for cells.
I have a UITableView with some custom cells in it. In these custom cells

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.