Open Phuket2 opened 8 years ago
@Phuket2 got code? I could not reproduce this
ui.View().present('popover',popover_location=(500,500))
works exactly as expected even with rotation. The popover location is in absolute screen coordinates - so obviously if you are in portrait and prsent with x=768, then switch to landscape, x will still be 768, so not at the edge. Not really a bug, I think more of an enhancement request-- you want some sort of popover flex.
@jsbain , I think the fact you can present a popover without a location sort of is saying it's a flex. You example is using a popover location. Using your same code without passing the the popover_location is what I am talking about.
By it's self, when you change orientation, you don't get the most desirable result. It would seem more natural that it would hold a relative x position. I don't think you could easily move the popup yourself anyway if you wanted it to stay in the default position between screen orientation changes.
I understand, it's show stopper. The reason I said possible bug, because it maybe a bug in omz's eyes. Just depending on how he meant for it work.
If it made your app look ugly, you could just close your popover on orientation changes I guess. That may not work so well if you are drilling down into subviews or folders for example.
Anyway, thought it was worth mentioning
import ui
ui.View(frame=(0, 0, 300, 400)).present('popover')
Edit... I just tried rotating my ipad with add event popover open in iOS calendar. It does the right thing (expected behaviour) when changing the orientation of the screen. But the view fades out and back in. Not sure if this is done for visual appeal or this is dealing with a iOS API limitation. Essentially closing and reopening the view to reposition it
On iPad Pro 12.9", when I present popover (without location), it points to the wrench button. When I rotate my iPad to portrait, popover is gone, because of the initial x/y - it's offscreen.
When I present it with location and I rotate my iPad, it stays where I say it should be and nicely disappears / appears during rotation animation.
I don't consider this as a bug, but rather as an enhancement. Developer is responsible for this.
We have popovers, we should have access to ...
- (void)popoverPresentationController:(UIPopoverPresentationController *)popoverPresentationController
willRepositionPopoverToRect:(inout CGRect *)rect
inView:(inout UIView * _Nonnull *)view;
... to allow us reposition popover during rotation for example.
If you present a ui.View as a popover without specifying and popup_location all goes as expected. But if you change the orientation of the screen while the popup is still is displayed, the y value seems ok, but the x value is somewhere in the middle of the screen.
I am not sure if you are suppose to code for this or it should self adjust. I thought it would self adjust.
In the scheme of things it's not a big deal. But depending on how it's suppose to work it could be a bug