How to move FPPopover as low as possible? If I press too low, it will return to the beginning

I use FPPopover to submit a pop view for my iPhone application. I have a problem, however, when when I present it, it will only allow me to present it so low or it will return to the top. And that’s good before it is cut off anyway.

For instance:

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

It works fine, but if I put 255 instead of 235 (since it's a good 40px from the bottom), it will go back up.

Does anyone have any experience with this or how can I fix this?

In addition, bonus points, if you can explain why the content for popover always starts, like 50px from the top, when I want it to run higher. How can I change this too?

More code from creation:

 - (void)speedOptionsTapped:(UIBarButtonItem *)sender { // Set the delegate in the controller that acts as the popover 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)]; } 
+6
source share
1 answer

Try replacing this piece of code in FPPopoverController.m:

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

using this code:

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

The reason you might have this problem is because the FPPopoverArrowDirectionIsVertical macro considers a popover without arrows that have a vertical arrow. So the result is that you are trying to position your popover as close as possible to the view that caused the popover.

If you replace the code as described above, you will create a special case for popovers without arrows and ask that you respect the starting points without re-positioning.

+3
source

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


All Articles