Comments (26)
Hi,
Thanks for the quick answer but I am not sure how to use it (and I think I did not explain really well the issue).
Bug explanation
I do not call setDrawerPosition
at all, it's the initialDrawerPositionFromIB
that is broken when used in another tab.
As you can see, I use Pulley
in the second tab.
When I open it, even if the initialDrawerPositionFromIB
is set to "collapsed", the drawer is animated from the top.
Here is the stack leading to setDrawerPosition(position: .collapsed, isAnimated: true)
PulleyViewController.viewDidLoad()
↘️ PulleyViewController.primaryContentViewController.didset
↘️ PulleyViewController.setNeedsSupportedDrawerPositionsUpdate()
↘️ PulleyViewController.supportedPositions.didset
↘️ PulleyViewController.setDrawerPosition(position:isAnimated:) //animated is true
You can simply debug it in the attached sample project by adding a breakpoint in PulleyViewController.setDrawerPosition()
at the first line and see that the first call is animated.
Proposed solution
My proposed solution was to allow us the override setDrawerPosition
.
The reason is that you may not want to manage this special case (in which Pulley is embed a another tab) as it may have side effects on the "natural" use case.
In this case, I would use a class extending PulleyViewController
and forcing animation to false if the call is the first one (even if I agree, it would just be a workaround).
The ideal solution would be to make it work in my case though.
I hope that I have made it clearer and sorry if not (I am relatively new to iOS development).
from pulley.
Okay, after some additional testing I've gone ahead and pushed this fix out to CocoaPods. It's version '2.2.9'. Assuming you haven't pinned your Pulley version, you can get the update by doing pod update Pulley
. You made need to run pod repo update
first.
Since this seems to be important to a lot of people, I'm gonna tag the people interested in this thread below so they see the notification.
@cyrilzakka @PomepuyN @azurechen @azhang66 @Vadim4016 @pablomarcos
If anyone has any issues, please let me know. I'll try to get them taken care of ASAP. Once a few people have reported back with success, then I'll close the issue. Thanks, everyone.
from pulley.
It sounds like an issue with how you’re adding it to your view hierarchy. For example, the demo project doesn’t have that issue.
How’re you adding / presenting the controller?
from pulley.
Turns out changing this to false seems to have fixed the issue!
public func setDrawerPosition(position: PulleyPosition)
{
setDrawerPosition(position: position, animated: false)
}
from pulley.
I second this issue.
I am currently using a PulleyViewController
in an UITabBarController
and when you load a tab for the first time, the drawer is jumping.
The only way to solve it for now is to import the lib manually and change the first setDrawerPosition
call to avoid the animation.
A quick and easy fix would be to declare this method open
so we can override it (and avoid having to clone the entire library).
Another one could be to allow the drawer not to animate the first setDrawerPosition
call.
from pulley.
Fixed for me. Thanks!
from pulley.
The new version also fixed the issue for me
from pulley.
Doing everything from Storyboard - nothing really special about my setup. Any ideas what I should look into?
from pulley.
Are you presenting Pulley? Or using it as a root view controller of a window? Or?
from pulley.
Were you trying to set it in viewWillAppear / viewDidAppear / viewDidLoad? If so, I would definitely expect some odd visual glitches with animation enabled.
If you’re setting it in one of those locations, consider using the starting drawer position property.
from pulley.
Yup you're definitely right - will try that instead and report back
from pulley.
How exactly is it supposed to be used? Doesn't seem to be doing anything at all
from pulley.
It has to be set before the view is loaded. Setting it after the view has loaded has no effect. If you’re setting it within your drawer or main content VC, it’s too late as the view has already loaded.
If you’re using Interface Builder, use the initial drawer state option exposed in Interface Builder so it is set before the view loads. It accepts a string of the appropriate enum (see Pulley VC for info on that variable). The regular non-Interface Builder variable is to be used when instantiating Pulley programmatically, and should be set before doing something that causes the view to load.
from pulley.
It worked but the jump is still there
from pulley.
Is that the “animate from corner” issue you were having? Or something else? I’m not sure what you mean by a “jump”?
from pulley.
Yup still the animation from corner issue, my bad. You really don't have to worry about it for now - my temporary solution seems to have worked with no repercussions. Thank you for your time btw
from pulley.
Ok- glad it worked for you. A lot of people seem to be interested in presenting Pulley as a VC (instead of as a root view controller), and it’s never really been tested / debugged for that use case. I’ll add that to my list of things to work on, so hopefully some of these issues can be prevented. Thanks for your patience! Glad you found a workaround.
from pulley.
I have a totally same issue. But my PulleyController is the destination of a segue. the whole view will jump at enter this PulleyController.
and I fixed this problem with the same solution.
public func setDrawerPosition(position: PulleyPosition)
{
setDrawerPosition(position: position, animated: false)
}
Maybe next version can solve this problem? Or just open setDrawerPosition
for overriding should be great too.
from pulley.
@PomepuyN @azurechen Thanks for the info. I just pushed a proposed solution to master. Can you guys try the current 'master' branch (download or point your Podfile to it) and see if that works for you?
NOTE: The change is that I added an optional parameter to setDrawerPosition
that allows you to specify whether or not to animate the change.
You can convert your current call to setDrawerPosition
from this:
pulley.setDrawerPosition(position: .collapsed)
to:
pulley.setDrawerPosition(position: .collapsed, isAnimated: false)
I think it's more appropriate to yield the animation option to the app as an option, rather than add work-arounds for situations where people may not want it animated.
Let me know if it works for you. If it does, I'll push it out over CocoaPods.
from pulley.
Unfortunately, this bug is still present, even in the demo app. The effect in the demo app is somewhat obscured by the iOS app loading animation, but you can clearly see that Pulley animates the drawer jumping from the top left of the screen.
Looking at the PullyViewController.swift, it looks like setDrawerPosition()
is called, with animated: false
. However, it's evident that the animation occurs anyway. My suspicion is that the "jumping" animation that we're seeing from the top left corner is not the animation caused by setDrawerPosition()
.
@Brendan09 thoughts?
from pulley.
I’ll take a closer look and see what I can find.
I won’t be marking setDrawerPosition as open, however, as it would require making far too many internal variables and functions public in order for people to write their own implementation of the function.
from pulley.
That's fine (I probably couldn't figure out how to reimplement it anyways). I think the main issue here is getting rid of the corner jumps (which shouldn't be there even by default).
from pulley.
Ok, everyone. I think I have a fix for this. Sorry about the delay / misunderstanding the issue.
@azhang66 If you're still near some code, do you mind giving the current code on Master a try? The fix worked for the sample project. I'm about to test it on the sample from @PomepuyN to see it it fixes that use case as well.
from pulley.
Okay, the fix seems to work for the sample project from @PomepuyN as well.
I'm going to go ahead and push this out over CocoaPods after a few more minutes of testing.
from pulley.
@Brendan09 thanks for your work mate!
from pulley.
Fantastic! I'm going to go ahead and close this issue then. Thanks for the help in tracking this one down, everyone!
from pulley.
Related Issues (20)
- Pulley hangs on xcode 12 ios 14. HOT 2
- iOS 13 feedback loop with latest release 2.8.3 HOT 10
- Unable to drag the drawer on iOS 14 HOT 5
- Animation HOT 4
- [QUESTION] Help with error: "When instantiating from Interface Builder you must provide container views with an embedded view controller. HOT 1
- App getting hang on iOS 14 using pulley HOT 1
- Navigator BAr
- Remove possibly unnecessary view
- [BUG] iPad panel mode problem HOT 1
- [BUG] The latest version Pulley 2.9.0 does not start PulleyViewController HOT 1
- [QUESTION] How to resize the content of the drawer as it is opened and closed HOT 1
- [BUG] There is a 20 pixel top inset for the PulleyPassThroughScrollView which doesn't accept user action HOT 3
- Is there any way to apply corner radius to only one side? HOT 2
- Open other controller within Drawer
- [QUESTION] Update bounceOverflowMargin HOT 1
- Pulley drawer dimming view appears after UINavigationViewController push new viewController
- [QUESTION] How to control bounce of pulley when it is used in UITabBarController
- Strange lines on mac catalyst 16
- Trying to instantiateViewController to open the pulley view controller
- I hope there are more convenient functions, such as the function of directly displaying the QR code
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 pulley.