ho开发者_运维知识库w to place the arrow of UIPopoverController, over UITableView's selected cell
You get to define the CGRect to which you want the popover to point.
CGPoint point = ...; // where they tapped on screen, taken from UIEvent, if you like
CGSize size = ...; // give a size range, maybe the size of your table cell
[popover presentPopoverFromRect:CGRectMake(point.x, point.y, size.width, size.height)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Try getting the CGRect for the selected row using the following method.
CGRect selectedRect = [self.tableView rectForRowAtIndexPath:indexPath];
Then use the rect when you present the UIPopoverController:
[myPopover presentPopoverFromRect:selectedRect .............inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
I believe the arrow is placed automatically by the popover view itself. So whatever you set the frame of the popover to be, it'll draw its arrow top and center.
精彩评论