Comments (16)
I observed the same issue. My destination view controller has map view and it doesn't zoom to correct map area to show all annotations because its frame wasn't set correctly by this animator.
The problem is about using presentedViewController.center
and presentedViewController.frame.size
as the originalCenter
and originalSize
. They return the same frame and center values as the ones that are returned in presentedViewController.viewDidLoad
which means they are highly inaccurate so can't be trusted. What you should do is to use the final frame of destination view controller at the end of the transition to set its center and the problem should go away:
if transitionMode == .present {
...
let finalFrame = transitionContext.finalFrame(for: toViewController!)
let originalCenter = CGPoint(x: finalFrame.width / 2, y: finalFrame.height / 2)
let originalSize = finalFrame.size
...
// Inside the animation block, set the frame:
UIView.animate(withDuration: .. {
...
presentedControllerView.frame = finalFrame
}
from bubbletransition.
I've had the same problem, because I use xib. My workaround:
presentedVC.view.frame = presentingVC.view.bounds
Steps to reproduce (I'm not sure):
- Create vc in xib
- Change vc size (Set other iPhone representation)
- Make bubble transition
Transition uses size from xib
from bubbletransition.
Hi @bianjingbulb
If you use a standard modal transition the view is there?
from bubbletransition.
@andreamazz thanks for replying me!!!
I pushed the view like this ↓
let newPersonPostViewController = NewPersonPostViewController() self.presentViewController(newPersonPostViewController, animated: true, completion: nil)
from bubbletransition.
Ok, but if you remove the bubble transition (and perform the system transition instead), does the issue go away?
from bubbletransition.
from bubbletransition.
Can you provide a sample showing this issue? Or at least reproduce the issue in the demo project? I'm having trouble reproducing this.
from bubbletransition.
I've got the same problem. When using everything in full code the destination controller layout constraints are broken...
from bubbletransition.
Please provide a sample showing the issue, I can't debug something that I can't reproduce.
from bubbletransition.
I just tried it in a new project and now it works. In my real app it doesn't. Then the constraints are broken. In the top left corner you see a label with some text and the constraints are center in middle of viewcontroller..
http://i65.tinypic.com/f37s4o.png
from bubbletransition.
I found the problem in my real app my ViewControllers have a BaseViewController that does some things. If I use this controller as base then it doesn't work:
class BaseViewController: UIViewController {
// MARK: - Properties
private var didSetupConstraints: Bool = false
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
self.setupNavigationBar()
self.navigationController?.interactivePopGestureRecognizer?.delegate = self
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
}
override func loadView() {
self.view = UIView()
self.view.backgroundColor = UIColor.whiteColor()
self.setupLoadView()
self.view.setNeedsUpdateConstraints()
}
override func updateViewConstraints() {
if !self.didSetupConstraints {
self.setupConstraints()
self.didSetupConstraints = true
}
super.updateViewConstraints()
}
// MARK: - Helpers
func setupNavigationBar() {
self.navigationItem.title = self.setupTitle()
}
func showWarningWithMessage(message: String) {
self.showAlert(message, title: "Warning")
}
func showErrorWithMessage(message: String) {
self.showAlert(message, title: "Error")
}
func showSuccess(message: String) {
self.showAlert(message, title: "Success")
}
private func showAlert(message: String, title: String) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "Ok", style: .Default, handler: nil)
alertController.addAction(defaultAction)
presentViewController(alertController, animated: true, completion: nil)
}
func setNavigationBarTransparant(transparant: Bool) {
self.navigationController?.navigationBar.translucent = transparant
}
// MARK: - Controller specific overrides
func setupLoadView() {
fatalError("Should be overwritten")
}
func setupConstraints() {
fatalError("Should be overwritten")
}
func setupTitle() -> String {
return ""
}
}
// MARK: - UIGestureRecognizerDelegate
extension BaseViewController: UIGestureRecognizerDelegate {
func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
if navigationController?.viewControllers.count == 2 {
return true
}
if let navigationController = self.navigationController as? CustomNavigationController {
navigationController.showControllers()
}
return false
}
}
from bubbletransition.
I'm facing this same issue... Anyone care to share how to fix it? @ozgur @donpironet @andreamazz
from bubbletransition.
@andreamazz maybe you have an update on this? To me, a new PR is likely needed.
from bubbletransition.
Again, I need a sample that reproduces the issue to test it.
If you have found the solution, a PR is always welcome.
from bubbletransition.
I had the same problem as you. This was solved putting the ViewController inside a storyboard. in a xib does not work
from bubbletransition.
Closing this for now. Feel free to reopen if you have sample code to reproduce the issue, or even better a PR.
from bubbletransition.
Related Issues (20)
- self.transitioningDelegate not retained HOT 5
- present two viewControllers at once HOT 1
- How to use the bubble transition programmatically? HOT 2
- Improvement: Add a background image for the bubble as an alternative of bubbleColor HOT 4
- swift 4? HOT 6
- Unbalanced calls to begin/end appearance transitions for HOT 6
- Swipe down to dismiss HOT 4
- Swift4 + ObjC HOT 1
- Animation Controller for Dismissed Not work in iOS 9.3 & iOS 12 HOT 6
- can't dismiss viewcontroller in ios12 HOT 1
- Good
- update for swift 4.2? HOT 1
- Wrong Frame Starting Center when Translucent is False HOT 1
- Any chance of navigation instead of presenting?
- Cannot use BubbleInteractiveTransition HOT 4
- Is it possible to accept gesture while animating? HOT 6
- It is possible to use this library to add child view controller to a container view? HOT 4
- Button clicks or tableview cell selection not working HOT 2
- about `UIStatusBarStyle` HOT 2
- Support Swift Packages Manager HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bubbletransition.