我正在使用包含一些输入字段的popover
。由于iOS键盘覆盖大屏幕区域,因此有时需要更正弹出窗口位置(通过移动其目标并在popover
上调用-presentPopoverFromView:targetView
)。我假设我无法精确确定弹出窗口的视图矩形,但是具有箭头方向和内容大小,我可以近似其当前位置。弹出箭头方向无法确定
问题在于,即使弹出窗口清晰可见,我也会不断得到未知的方向(UIPopoverArrowDirectionUnknown
)。
在iOS 5.1 UIKit.framework中,头文件UIPopoverController.h
我们可以看到,我们可以得到popover arrow
(上下左右是未知之一)的当前方向。唯一的条件是需要显示popover
。
/* Returns the direction the arrow is pointing on a presented popover. Before presentation, this returns UIPopoverArrowDirectionUnknown.
*/
@property (nonatomic, readonly) UIPopoverArrowDirection popoverArrowDirection;
我们可以确定酥料饼呈现一个getter isPopoverVisible
:但是
/* Returns whether the popover is visible (presented) or not.
*/
@property (nonatomic, readonly, getter=isPopoverVisible) BOOL popoverVisible;
尽管我可以看到酥料饼的箭头瞄准向上或向下等和myPopover.isPopoverVisible == YES
,箭头方向仍然是myPopover.popoverArrowDirection == UIPopoverArrowDirectionUnknown
。
[self presentPopoverFromRect:sourceView.frame inView:sourceView.superview
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
EDIT(解决方案)
我的iOS 5.0.1我的设备(新iPad)上安装:
的popover
被提出。编制目标是5.1。将设备更新至5.1后,问题完全消失。
如果您已经解决了问题,请发布答案并将其标记为已接受,所以问题不会显示为未答复。 – Greg 2012-10-05 12:09:37
@PartiallyFinite,谢谢。学习... – Greg 2012-10-10 16:26:11