如何使用特定点上的箭头显示准备好的popover(TableView内部)?基本上,我有一个CGPoint screenPointContainer,我想在那里显示我的popover。没有矩形,没有按钮。 只需一点。
detailsPop.popoverContentSize = CGSizeMake(250, 300);
CGRect myrect = CGRectMake(screenPointContainer.x, screenPointContainer.y, ??, ??);
[detailsPop presentPopoverFromRect:myrect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
答案 0 :(得分:3)
你能不能只创建1像素大小的CGRect?这基本上是一个要点:
CGRect myRect = CGRectMake(screenPointContainer.x, screenPointContainer.y, 1, 1);
答案 1 :(得分:1)
我没有找到坐标失真的原因(上部60个单位)并且必须手动编辑坐标,包括方向检查。矩形的H和W均为0。 现在没关系:
if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)
{
CGRect myrect2 = CGRectMake(screenPointContainer.x+320, screenPointContainer.y+60, 0, 0);
[detailsPop presentPopoverFromRect:myrect2 inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
CGRect myrect2 = CGRectMake(screenPointContainer.x, screenPointContainer.y+60, 0, 0);
[detailsPop presentPopoverFromRect:myrect2 inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}