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!