The direction of the arrow cannot be determined

I use a popover that contains some input fields. Since the iOS keyboard covers a large area of ​​the screen, sometimes I need to adjust the location of the pop-ups (by moving its target and calling -presentPopoverFromView:targetView on a popover ). I assume that I cannot pinpoint the rectangle of the popup window, but with the direction of the arrow and the size of the content, I could get closer to its current location.

The problem is that I get a constantly unknown direction ( UIPopoverArrowDirectionUnknown ), even when the popup is clearly visible.

In iOS 5.1, UIKit.framework, the header file of UIPopoverController.h , we can read that we can get the current direction of the popover arrow (one of the following: up, down, left, right, is unknown). The only condition is that you need to specify a popover .

  /* Returns the direction the arrow is pointing on a presented popover. Before presentation, this returns UIPopoverArrowDirectionUnknown. */ @property (nonatomic, readonly) UIPopoverArrowDirection popoverArrowDirection; 

We can determine if a popover is represented using getter isPopoverVisible :

  /* Returns whether the popover is visible (presented) or not. */ @property (nonatomic, readonly, getter=isPopoverVisible) BOOL popoverVisible; 

But despite the fact that I see a popover arrow pointing up or down, etc., and myPopover.isPopoverVisible == YES , the direction of the arrow is still myPopover.popoverArrowDirection == UIPopoverArrowDirectionUnknown .

popover represented by:

 [self presentPopoverFromRect:sourceView.frame inView:sourceView.superview permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

EDIT (solution)

I had iOS 5.0.1 installed on my device (iPad). The purpose of compilation is 5.1. After updating the device to 5.1, the problem disappeared completely.

+4
source share
1 answer

I had iOS 5.0.1 installed on my device (iPad). The purpose of compilation is 5.1. After updating the device to 5.1, the problem disappeared completely.

0
source

Source: https://habr.com/ru/post/1403556/


All Articles