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 7920475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:14:04+00:00 2026-06-03T16:14:04+00:00

I am having real troubles adding a UIImageView to a single UITableView cell. In

  • 0

I am having real troubles adding a UIImageView to a single UITableView cell. In my Storyboard I have a UITableViewController and four prototype dynamic cells. Three of them are just fine as normal left detail cells and they work fine. However one of them I need to have a UIImageView in.

So I have added said view to the cell, given the cell a custom class with a property so I can access the image view.

I have the following cells:

Title cell.
Image Cell.
URL Cell.
Notes Cell.

The contents of the table view change depending on whether the user wants to add a URL, note or image. So the user always sees the title cell with one of the others.

Here is my code and for whatever reason I just can’t get the UIImageView to display on that image cell.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{

    static NSString *CellIdentifier = @"Cell";

    //0 = Image
    if ([[NSUserDefaults standardUserDefaults] integerForKey:@"NewScrapbookEntry"] == 0) 
    {
        if (indexPath.row == 0) CellIdentifier = @"titleCell";
        if (indexPath.row == 1) CellIdentifier = @"imageCell";
        if (indexPath.row == 2) CellIdentifier = @"notesCell";
    }
    //1 = URL
    else if ([[NSUserDefaults standardUserDefaults] integerForKey:@"NewScrapbookEntry"] == 1) 
    {
        if (indexPath.row == 0) CellIdentifier = @"titleCell";
        if (indexPath.row == 1) CellIdentifier = @"urlCell";
        if (indexPath.row == 2) CellIdentifier = @"notesCell";
    }
    //2 = Notes
    else if ([[NSUserDefaults standardUserDefaults] integerForKey:@"NewScrapbookEntry"] == 2) 
    {
        if (indexPath.row == 0) CellIdentifier = @"titleCell";
        if (indexPath.row == 1) CellIdentifier = @"notesCell";
    }

    ScrapbookImageDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[ScrapbookImageDetailCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier];
        cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

    [cell setBackgroundColor:[UIColor colorWithRed:250.0f/255.0f green:250.0f/255.0f blue:250.0f/255.0f alpha:1.0f]];
    [cell setSelectionStyle:UITableViewCellSelectionStyleGray];

    cell.textLabel.adjustsFontSizeToFitWidth = YES;

    cell.textLabel.text = [firstSection objectAtIndex:indexPath.row];
    cell.detailTextLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:13.0f];
    cell.detailTextLabel.numberOfLines = 0;
    cell.accessoryView = nil;

    switch (indexPath.section) 
    {
        case 0:
            switch (indexPath.row) 
        {
            case 0: 
            {                
                cell.detailTextLabel.text = scrapbook.title;
            } 
                break;

            case 1: 
            {
                //0 = Image
                if ([[NSUserDefaults standardUserDefaults] integerForKey:@"NewScrapbookEntry"] == 0) 
                {
                    cell.detailTextLabel.text = nil;
                    cell.iv.image = [UIImage imageNamed:@"image.png"];
                }
                //1 = URL
                else if ([[NSUserDefaults standardUserDefaults] integerForKey:@"NewScrapbookEntry"] == 1) 
                {
                    cell.detailTextLabel.text = scrapbook.url;
                }
                //2 = Notes
                else if ([[NSUserDefaults standardUserDefaults] integerForKey:@"NewScrapbookEntry"] == 2) 
                {
                    cell.detailTextLabel.text = scrapbook.notes;
                }
            } 
            break;

            case 2:
            {
                cell.detailTextLabel.text = scrapbook.notes;
            }
            break;

            default:
                break;
        }
        break;

        default:
            break;
    }

    return cell;
}
  • 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-06-03T16:14:05+00:00Added an answer on June 3, 2026 at 4:14 pm

    Why are you changing the identifier value? The thing you just have to do is make custom cell, and in height for row, check if it’s your desired row, and return with height of image else default size, and in cell for row method, again check desired row and add the image you want to add else make the imageview nil.

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

Sidebar

Related Questions

I am having real trouble with provisioning and code signing issues. I have migrated
I have the following jquery I'd like to convert to prototype. I am having
I have the following scenario: User->HABTM->businesses Suppliers->HABTM->businesses Suppliers->HAS_MANY->Payments I am having real trouble working
Been having real trouble with this one and wondered if someone may have found
I am having real trouble installing SUDS in python 2.6.4. I have tried to
ok i am having real troubles with screen orientation. My application has a countdown
I'm having a real trouble to get accents right, and I believe this may
I'm having real problems getting PDO_MYSQL working. I started by just trying to install
I've been having real problems trying to get a ruby script to run through
I am having real problems trying debug my code to malfunctioning print statements. I

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.