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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:20:55+00:00 2026-05-31T18:20:55+00:00

I have a custom UITableView cell that has a UIImageView sized to the width

  • 0

I have a custom UITableView cell that has a UIImageView sized to the width of the cell at the top, and a UILabel underneath it.

A UITableViewCell has an imageView property. If the image view’s image is set, then it pushes the cell textLabel to the right, to accomodate the image. I would like to do something similar with my table view cell (except that my label would be pushed down).

How could I accomplish this?

  • 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-31T18:20:57+00:00Added an answer on May 31, 2026 at 6:20 pm

    A simple way to do it is to subclass UITableViewCell and override layoutSubviews method.

    Here a simple example.

    @interface CustomCell : UITableViewCell
    
    @end
    
    @implementation CustomCell
    
    - (void)layoutSubviews
    {
       [super layoutSubviews];
    
       // grab bound for contentView
       CGRect contentViewBound = self.contentView.bounds;
    
       if(self.imageView.image) {
          // do stuff here, for example put the image right...
          CGRect imageViewFrame = self.imageView.frame;
          // change x position
          imageViewFrame.postion.x = contentViewBound.size.width - imageViewFrame.size.width;
          // assign the new frame
          self.imageView.frame = imageViewFrame;
       }
    
       else {
          // do stuff here
       }
    }
    

    In particular inside this method you can position the components for your cell depending on image.

    Hope it helps.

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

Sidebar

Related Questions

I have a project with a custom UITableViewCell (cell.h/.m/.xib) that has 2 labels (labelMain/labelSub),
I have a custom UITableViewCell that has a UISegmentedControl object. My UITableView (questionnaire form)
Similar to this question I have a custom subclass of UITableViewCell that has a
I have a custom UITableView cell which has a button and a label. I
I have a custom UITableViewCell nib that has an image on the left side
I have a custom UITableViewCell that has 2 buttons and a label on it.
So I've built a custom cell for a UITableView. My subclassed UITableViewCell has a
I have a custom cell for a UITableView. The cell has a button in
I have a custom UITableViewCell subclass. I have set the contentView of my cell
I have a custom UITableViewCell which has an image & and some text. When

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.