6

我正在使用FPPopover为我的 iPhone 应用程序呈现弹出视图。但是,我遇到了一个问题,当我展示它时,它只会让我展示它的位置太低,否则它会跳到顶部。无论如何,这是在它被切断之前。

例如:

[self.speedOptionsPopover presentPopoverFromPoint:CGPointMake(0, 235)];

工作正常,但如果我把它设置为 255 而不是 235(因为它距底部 40 像素很好)它会跳回顶部。

有没有人有这方面的经验或我该如何解决?

另外,如果你能解释为什么弹出框的内容总是从顶部开始 50px,当我希望它开始更高时,加分。我该如何改变呢?

更多来自创作的代码:

- (void)speedOptionsTapped:(UIBarButtonItem *)sender {
    // Set the delegate in the controller that acts as the popover's view to be self so that the controls on the popover can manipulate the WPM and number of words shown
    self.speedOptionsController.delegate = self;

    self.speedOptionsPopover.arrowDirection = FPPopoverNoArrow;
    self.speedOptionsPopover.border = NO;
    self.speedOptionsPopover.contentSize = CGSizeMake(320, 190);
    [self.speedOptionsPopover presentPopoverFromPoint:CGPointMake(0, 235)];
}
4

1 回答 1

3

尝试替换 FPPopoverController.m 中的这部分代码:

//ok, will be vertical
if(ht == best_h || self.arrowDirection == FPPopoverArrowDirectionDown)

使用此代码:

//ok, will be vertical
if (self.arrowDirection == FPPopoverNoArrow)
{
   r.origin.x = p.x;
   r.origin.y = p.y;
}
else if(ht == best_h || self.arrowDirection == FPPopoverArrowDirectionDown)

您可能遇到此问题的原因是宏 FPPopoverArrowDirectionIsVertical 将没有箭头的弹出框视为具有垂直箭头。因此,结果是尝试将您的弹出框尽可能靠近触发弹出框的视图。

如果您按照上面指示替换代码,您将为没有箭头的弹出框创建一个特殊情况,并要求在不重新定位的情况下尊重原始点。

于 2013-05-21T19:26:48.380 回答