Dou*_*ith 6 objective-c uiview uipopovercontroller ios
我正在使用FPPopover为我的iPhone应用程序呈现弹出视图.然而,我遇到了一个问题,当我提出它时,它只允许我将它呈现得如此之低或者它会跳到顶部.在它被切断之前就已经好了.
例如:
[self.speedOptionsPopover presentPopoverFromPoint:CGPointMake(0, 235)];
Run Code Online (Sandbox Code Playgroud)
工作得很好,但如果我把它设为255而不是235(因为它从底部是一个很好的40px)它会跳回到顶部.
有没有人有这方面的经验或我如何解决它?
此外,如果您可以解释为什么popover的内容总是从顶部开始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)];
}
Run Code Online (Sandbox Code Playgroud)
尝试替换 FPPopoverController.m 中的这部分代码:
//ok, will be vertical
if(ht == best_h || self.arrowDirection == FPPopoverArrowDirectionDown)
Run Code Online (Sandbox Code Playgroud)
用这个代码:
//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)
Run Code Online (Sandbox Code Playgroud)
您可能遇到此问题的原因是宏 FPPopoverArrowDirectionIsVertical 将没有箭头的弹出窗口视为具有垂直箭头。因此,结果是尝试将弹出窗口放置在尽可能靠近触发弹出窗口的视图的最佳位置。
如果您替换上面所示的代码,您将为没有箭头的弹出窗口创建一个特殊情况,并要求尊重原始点而不重新定位。
| 归档时间: |
|
| 查看次数: |
406 次 |
| 最近记录: |