2

I'm trying to do something pretty simple, but I can't figure out how to anchor the popover to the DisclosureButton on a UITableViewCell. Can anyone help me with a simple example of how to use presentPopoverFromRect that will properly anchor to the accessoryView?

Thanks!

p.pad
  • 529
  • 7
  • 11

1 Answers1

4

Have you tried using UIView's - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view to convert the accessoryView's rect?

soh-la
  • 360
  • 1
  • 4
  • Perfect, that worked great. Thanks for pointing me to it! So, in my case, I was anchoring to a UITextField in a UITableViewCell, and the code ended up being CGRect theAnchor = [cell.contentView convertRect:textField.frame toView:baseTableView]; – p.pad Aug 07 '11 at 19:14
  • nice hint, but you'll need the rect before converting it. I found this answer very helpful to get the rect of the accessoryView: http://stackoverflow.com/a/11143908/388412 – auco Jan 01 '13 at 18:46