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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:34:50+00:00 2026-06-10T16:34:50+00:00

I have a fairly simple TableViewController listing items that can be checked as they

  • 0

I have a fairly simple TableViewController listing items that can be checked as they are collected. I have successfully implemented a word wrapped label in each cell, and updated heightForRowAtIndexPath such that each row is a suitable height. This is working well:

note: I have set a garish background color on the cell’s contentView for testing purposes.

enter image description here

The problem comes when I try to add a checkmark button as the accessoryView for each cell:

    UIImage *image = [UIImage imageNamed:@"checked.png"];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    CGRect frame = CGRectMake(0.0, 0.0, 44.0, 44.0);
    button.frame = frame;
    [button setImage:image forState:UIControlStateNormal]
    button.backgroundColor = [UIColor redColor];
    cell.accessoryView = button;

For some reason, the alignment is not quite right for my cells that span more than one line once the button size exceeds about 26×26 pixels.

enter image description here

The example above uses 44×44 as the button width.

Can anyone explain what is going on here? Why would there be a different alignment when the contentView is 2-lines versus one? Infact, for each extra line that the text uses, the alignment is increasingly off. I can add the code for the row text if it will help.

  • 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-10T16:34:51+00:00Added an answer on June 10, 2026 at 4:34 pm

    I found that this can be resolved by setting the height of the button in the accessory view to match what will be calculated for the row.

    So, the code used in heightForRow:atIndexPath: should be copied in to the cellForRowAtIndexPath and used to set the button’s height.

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

Sidebar

Related Questions

I have a fairly simple web application that gets a list of items from
I have a fairly simple bit of VBA in Word 2003 that changes the
I have a fairly simple python loop that calls a few functions, and writes
I have a fairly simple class that I want to save to SQL Server
I have fairly simple problem but I can not think of the simple solution.
I have a fairly simple database that I inherited. For the purposes of this
I have a fairly simple console app that monitors an exchange mailbox, picks particular
I have a fairly simple query that runs super fast most of the time
I have a fairly simple question: In Javascript how can I return the boolean
I have a fairly simple problem. I'm trying to make a function that accepts

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.