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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:39:17+00:00 2026-06-03T19:39:17+00:00

I add a button as a subview to my tableviewcells. Works fine. But I

  • 0

I add a button as a subview to my tableviewcells. Works fine. But I can’t seem to figure out, how to force it to always be at the bottom of the cell. (On top of the separator line if you will). The cell height varies, so a fixed position is not smart. But I have no clue how to add it with a dynamic position. Here’s the code for adding the button:

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
    action:@selector(buttonPressed:)
    forControlEvents:UIControlEventTouchDown];
    [button setTitle:@"+1" forState:UIControlStateNormal];
    button.frame = CGRectMake(0.0f, 70.0f, 160.0f, 15.0f);
    [cell addSubview:button];
  • 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-03T19:39:18+00:00Added an answer on June 3, 2026 at 7:39 pm

    Set the autoresizing mask when adding the button. I think the setting you want is:

    button.autoresizingMask = UIViewAutoResizingFlexibleTopMargin;
    

    Do this after adding the button to the cell.

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

Sidebar

Related Questions

Can you add a button as a subview to a uitableview cell and have
When I click on Add button , the formAddNewRow form opens , but I
I am using following code for add button with image on tool bar, but
net website, I would like to add button by which user can view the
I'm trying to add a subview once button is clicked, then bring it to
In my application, users can add UIImageView as subview of my UIScrollView . When
I am trying to add subview contains uipickerview and Done button using the following
How can I add an UIView as a subview in a cells contentView when
I dynamically add a subview to another uiview; in the subview ,click a button
I'm trying to add a view as a button's subview like this ( btn1

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.