Xcode 从一个点弹出
如何在一个特定点上用箭头显示一个准备好的popover(内部的TableView)?基本上,我有一个CGPoint屏幕点容器,我想在那里展示我的popop。没有矩形,没有按钮。 只有一点Xcode 从一个点弹出,xcode,ios,ipad,Xcode,Ios,Ipad,如何在一个特定点上用箭头显示一个准备好的popover(内部的TableView)?基本上,我有一个CGPoint屏幕点容器,我想在那里展示我的popop。没有矩形,没有按钮。 只有一点 detailsPop.popoverContentSize = CGSizeMake(250, 300); CGRect myrect = CGRectMake(screenPointContainer.x, screenPointContainer.y, ??, ??); [detailsPop presen
detailsPop.popoverContentSize = CGSizeMake(250, 300);
CGRect myrect = CGRectMake(screenPointContainer.x, screenPointContainer.y, ??, ??);
[detailsPop presentPopoverFromRect:myrect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
你能不能创建一个1像素大小的CGRect?这基本上是一个要点:
CGRect myRect=CGRectMake(screenPointContainer.x,screenPointContainer.y,1,1)代码>您能否创建一个1像素大小的CGRect?这基本上是一个要点:
CGRect myRect=CGRectMake(screenPointContainer.x,screenPointContainer.y,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];
}
我没有找到坐标扭曲的原因(上面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];
}
在本例中,popover生成的值高于实际单击点。在本例中,popover生成的值高于实际单击点。