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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:41:26+00:00 2026-05-26T17:41:26+00:00

sorry for the silly question, but I’m still in the process of learning Objective-C

  • 0

sorry for the silly question, but I’m still in the process of learning Objective-C and iPhone programming.

I’m trying to insert an icon to the left of a UITableView cell. This is from the method (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath :

NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"icon3" ofType:@"png"];
UIImage *icon = [UIImage imageWithContentsOfFile: imagePath];
cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
cell.imageView.image = icon;

My icon (30w x 44h) MUST be as high as the cell, while at the moment it remains a little space (maybe 1 pixel) above it and below. I tried to change the dimensions of the image with no success and I tried to reduce the height of the cell (with no effect) with (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath.

What can I do?

Eventually I should insert a little space on the left too, but this is secondary.

Thanks very much.

This is the screenshot: check that white pixel above the yellow icon

[UPDATE] no problem when the UITableView is not “grouped”

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

    You need to change the height of the row for the cell.imageView to be resized.

    implement the following method and return the height of your image.

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    

    Try also removing the contentMode setting in your cellForRowAtIndexPath method. You can replace all your code with one line as below:

    cell.imageView.image = [UIImage imageNamed:@"icon3.png"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if it's a silly question , but I'm just starting learning GWT and
Sorry for such a silly question but Python docs are confusing... Link 1: Queue
Sorry for this silly question, but is there any way to restrict using directives
Sorry if this is a silly question or if it's been answered already, but
Sorry if this question sounds a little silly, but I am not sure what
Sorry for such a trivial question, but I'd feel silly building this if it
I'm using Symfony 1.4 with Doctrine. Sorry if this is a silly question but
Sorry for the silly question, but I ran across code that used: <?=$MAP_OBJECT->printOnLoad();?> <?=$MAP_OBJECT->printMap();?>
sorry for the silly question, but i am stuck converting for example the following
Sorry about this silly question. I'm trying to learn objc and I'm unable to

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.