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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:55:41+00:00 2026-05-21T03:55:41+00:00

i want to display an image besides the text in table cell. i have

  • 0

i want to display an image besides the text in table cell. i have 2 sections, General and Assignments. Now i only want to display image beside Assignments and no image besides General section. the below code displays images for Assignments section and then again repeats the images for General section. Can anybody help me how to accompalish this.

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
– (void)viewDidLoad {

    staffImages = [[NSMutableArray alloc] init];

    NSArray *arrTemp1 = [[NSArray alloc] initWithObjects:@"TRANSPORTATION",@"ROOMS",@"ACTIVITIES",nil];
    NSArray *arrTemp2 = [[NSArray alloc] initWithObjects:@"CHAT",@"SEARCH",@"CALL",@"MORE",nil];

    NSDictionary *temp =[[NSDictionary alloc] initWithObjectsAndKeys:arrTemp1,@"Assignments",arrTemp2,
                                                                                   @"General",nil];

    //Add item images
    [staffImages addObject:@"transportation.png"];
    [staffImages addObject:@"hotel.png"];
    [staffImages addObject:@"activities.png"];


    //Set the title
    self.navigationItem.title = @"STAFF ASSIGNMENTS";
    self.tableContents=temp;
    [temp release];

    self.sortedKeys =[self.tableContents allKeys];
    [arrTemp1 release];
    [arrTemp2 release];

    [super viewDidLoad];
}


- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";

    NSArray *listData =[self.tableContents objectForKey:[self.sortedKeys objectAtIndex:[indexPath section]]];

    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
    if(cell == nil) {
        cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
                         reuseIdentifier:SimpleTableIdentifier] autorelease];

        }
    NSUInteger row = [indexPath row];
    cell.textLabel.text = [listData objectAtIndex:row];

    cell.imageView.image = [UIImage imageNamed:[staffImages objectAtIndex:indexPath.row]];

    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-05-21T03:55:42+00:00Added an answer on May 21, 2026 at 3:55 am

    Assuming the general section is section 0 (i.e. first section)

       if (indexPath.section == 1) {
        cell.imageView.image = [UIImage imageNamed:[staffImages objectAtIndex:indexPath.row]];
    
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with some text and links. I want to display image
I have a simple problem with an image going under text, rather than beside
I'm developing a wordpress theme for general release. I want to display an image
I want to display an image in graphics mode. I have read the image
I have an image that I want to display on a UIBarButtonItem, but for
I want to display an image and some text on the URL bar of
i want's to display image capture using device camera and for that i have
I want to display image in TextView with text, I had used Html.ImageGetter but
I have some Thumbnail images .I want to display image thumbnails in a Panorama(or
I have an image URL. I want to display an image from this URL

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.