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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:46:06+00:00 2026-05-15T02:46:06+00:00

I am new to iPhone programming and working on my first real application (i.e.

  • 0

I am new to iPhone programming and working on my first real application (i.e. one not written in a book or online) and I’ve run into a small problem which I could solve a multitude of ways, but feel like there should be a good solution that perhaps I am just missing.

Here is the scenario: I have a UITableView with a bunch of standard UITableViewCells in it. What I want to do is toggle a green check mark when the cell is selected and I have that part working (note: I’m already using the accessoryType for something else, so I can’t use it for the checkmark…besides, it’s not as pretty). Unfortunately, when I toggle the checkmark like so:

if (...) {
  cell.imageView.image = [UIImage imageNamed:@"checkmark.png"];
} else {
  cell.imageView.image = nil;
}

It makes the cell’s label bounce back and forth depending on whether it is checked or not. What is the proper way to align the cell’s text (set via cell.textLabel.text) regardless of whether or not it has an image set? The solutions I have come up with are:

  1. Create a blank 40×40 png image in Photoshop and set the unchecked to that
  2. Create a blank 40×40 image solely in code
  3. Set some setting that I don’t know about that will align it for me
  4. Create a subclass of UITableCellView that does what I need (which would be stupid, I’d just go with option 1…)

Suggestions? Thoughts? Comments? Thank you very much 🙂

P.S. I’d like the solution to work with OS 3.0 and 4.0 if that makes any sort of difference.

  • 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-15T02:46:07+00:00Added an answer on May 15, 2026 at 2:46 am

    Option 1 is the way to go for a standard cell.

    Strictly speaking, you do not have to subclass UITableViewCell to customize the layout. You can add any views you wish to the contentView. So you can add a UILabel and UIImageView to the contentView instead of using the imageView and textLabel properties.

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

Sidebar

Related Questions

im new to iPhone programming..in my app the timer is not working fine. can
I'm new to programming in Objective-c and the iPhone but I am working on
I am new in to iPhone programming, I am currently working on ballsplit game.
I am new in iphone programming. I am making an application in which I
I am new to iPhone programming. what I am trying is I have one
I am very new to iPhone programming and am running into a little bit
I am new to iphone Programming . I am using localNotification in my application.It
I am new to programming for the iPhone and this will be my first
I am new to iPhone programming and Objective-C. I am building a View-based application.
am new to iphone programming. I have a viewcontoller with an alertview in it.

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.