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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:41:25+00:00 2026-05-11T23:41:25+00:00

I have a UIButton in a UITableView cell, in a UITableView. The result is

  • 0

I have a UIButton in a UITableView cell, in a UITableView. The result is a list with buttons in it. When the UIButton is pressed, it calls a touchUpInside method, and all is great. What I am having problems with is that I want to zoom out a new view from the location (frame) of the button when it is pressed. If I just get the bounds of the UIButton

origButton.frame

it is in the coordinates of the UITableCell, something like 3,50,40,25. This is the same for all buttons in the list, so no matter which button in the list gets pressed, then I get these coordinates. Now, if I actually grab the coordinates of my view

self.frame

when the touchUpInside method is called, I get something more usable. I then get the coordinates of my cell. Great!! So I can zoom out a new view from the UIButton. Great!!

But here’s the problem: If you scroll up the list, tap the button, the view zooms out not from the button but from a location below the screen. The problem is, that the coordinates I have are for the cell, BEFORE it is scrolled up. In fact all coordinates for all cells reflect their actual locations in the table, with only the coordinates of the first visible set usable. Scrolling has not changed these coordinates.

I thought maybe I could use the super view’s coordinates, but those are of no help.

Anyone know how to get accurate coordinates for buttons (or views or any other items) listed in a table, or is it not possible?

Here is how I calculate the center point of my new view:

floatingView.center = CGPointMake(origButton.frame.origin.x + 
                                  origButton.frame.size.width / 2,
                         self.frame.origin.y + self.superview.frame.origin.y);

Thanks!

  • 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-11T23:41:25+00:00Added an answer on May 11, 2026 at 11:41 pm

    Update:

    Remember the a UITableView is a scrollView. So it has contentView embedded within the tableView (a scrollView).

    The frame you are receiving is correct, but it is not in reference to the view frame you want. Instead the frame is in reference to the contentView. As you scroll, the cells do not change in reference to contentView.frame. However, contentView.frame DOES change in reference to the frame of the tableView as you scroll (by the amount of the contentOffset).

    So this leaves 2 options:

    Convert the frame of the cell from reference of the contentView to the tableView using one of the following:

     - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view
    
     - (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view
    

    Or, manually subtract off the contentOffset from the frame.

    I recommend the first method.


    Original Answer:

    I’m not sure if you subclassed UITableViewCell or are performing this code from the UITableViewController.

    However, I think the method you want is:

    - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath
    

    This is a method of UItableView that will get you the rect for any cell.

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

Sidebar

Ask A Question

Stats

  • Questions 212k
  • Answers 212k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can try this: fast CSV Parser. Here's the benchmark… May 12, 2026 at 10:20 pm
  • Editorial Team
    Editorial Team added an answer Your code isn't called until the entire request has been… May 12, 2026 at 10:20 pm
  • Editorial Team
    Editorial Team added an answer jQuery's animate and hide functions have callbacks you can use.… May 12, 2026 at 10:20 pm

Related Questions

What I'm trying to do is replicate the NSTokenField like UITextField seen in the
I have a UIView (created in IB) with a grouped UITableView as a subview.
As shown in the screenshot below, i have a UITableView with some info and
I'm on a project doing an iPhone application. We had a Cocoa consultant come

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.