Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popover with AutoLayout? #102

Open
lpbas opened this issue Feb 21, 2018 · 2 comments
Open

Popover with AutoLayout? #102

lpbas opened this issue Feb 21, 2018 · 2 comments

Comments

@lpbas
Copy link

lpbas commented Feb 21, 2018

Hello. I'm using this awesome library to show quick pop ups in my app where the user takes a small action. However, on rotation, the popup does not stay in place, so I would like to use AutoLayout to keep it in place.

Whenever I try though, the pop either disappears or one of its corners gets entered in the screen.

Is there a way to fully manage the popup via auto layout? Thank you very much!

@alexsteinerde
Copy link

Is their any progress to supporting device rotation in some way?

@lpbas
Copy link
Author

lpbas commented Feb 9, 2019

I don't know if the dev is looking into the problem. For the moment, I'm dismissing the popover in viewWillTransitionToSize: and showing it again when the rotation finishes like this:

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
	super.viewWillTransition(to: size, with: coordinator)

	// Will execute before rotation
	var shouldShowNote = false
	if notePopover != nil {
		shouldShowNote = true
		notePopover?.dismiss()
	}

	coordinator.animate(alongsideTransition: {(_ context: Any) -> Void in
		// Will execute during rotation
	}, completion: {(_ context: Any) -> Void in
		// Will execute after rotation
		if shouldShowNote {
			self.noteTapped(nil)
		}
	})
}

where noteTapped() presents my popover. Keep your popover into a local property. It looks semi-ok, with the animations, but it would be great if the library handled rotation properly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants