ipad UIPopoverController
答
我相信箭头是由弹窗视图本身自动放置的。因此,无论您设置弹出窗口的框架,它都会将箭头放在顶部并居中。
答
您可以定义您希望弹出窗口指向的CGRect。
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];
答
尝试使用以下方法获取所选行的CGRect。
CGRect selectedRect = [self.tableView rectForRowAtIndexPath:indexPath];
然后使用矩形时呈现UIPopoverController:
[myPopover presentPopoverFromRect:selectedRect ............. inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft动画:YES];