52inc / pulley Goto Github PK
View Code? Open in Web Editor NEWA library to imitate the iOS 10 Maps UI.
Home Page: https://cocoapods.org/pods/Pulley
License: MIT License
A library to imitate the iOS 10 Maps UI.
Home Page: https://cocoapods.org/pods/Pulley
License: MIT License
If we render a view controller on the drawer content. The bottom layout is below the screen so the interface gets cut at the bottom of the controller's view.
All is in the title :)
Nice work anyway i love using it !
My goal is to disable the full size for some drawers. I think the drawer delegate is the place to do this.
Pretty much the title, should be a quick fix
Hi guys. Very good lib. But i just realized one strange situation. If we put tableview to pulley then during scrolling rows are updating.
Just change sample's code as following and you will see
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 15
}
var i = 0
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let row = tableView.dequeueReusableCell(withIdentifier: "SampleCell", for: indexPath)
row.detailTextLabel?.text = String(i)
i += 1
return row
}
if tableview row count is more than 10 or 15 then rows may be duplicated even 3 or 4 times.
Thank you for attention.
I have an issue with the animations when I call the
setDrawerContentViewController(controller:animated:)
method to switch drawer content view controllers.
The new content view controller has a initial frame of size .zero
in the transition animation and is scaling up to the target layout.
Could it be possible that the PulleyViewController
is accidentally animating the relayout of the view controller?
I think it would be better to set the full size the way we set collapsed and partial size to be more consistent. Tho, You may still keep the inset as a minimum distance or something like this.
I am currently writing an app where the drawerViewController
is an UINavigationController
. Based on in which screen I am in the UINavigationController
the drawerHeight
should adjust and the positions
should only support a certain one.
In my PulleyViewController
I implemented the delegate: PulleyViewController
and for each method I return a variable that represents the active 'state'. This state is given by the NSNoificationCenter
and it looks like this:
@objc func setPulleyPossibilities(notification:NSNotification){
if let positions = notification.object as? [Int] {
if positions.isEmpty {
self.drawerPositions = PulleyPosition.all
return
}
var newPositions:[PulleyPosition] = []
for position in positions{
newPositions.append(self.determinePositionBy(position: position))
}
self.drawerPositions = newPositions
}
self.setNeedsSupportedDrawerPositionsUpdate()
}
The thing is, that I red in the usage that I need to call self.setNeedsSupportedDrawerPositionsUpdate()
after doing this but this does not happen unfortunately. I also set the delegate and I see it actually updating in the debugger of xcode.
Another strange thing is that I've set a breakpoint in the delegate methods but they don't fire for somer eason but, the variables in the PulleyViewController
is updated!
Hello, in the picture below you can see how I build up the drawer content in the storyboard. What you can't see is that the pulleyVC is also embed in a tabbarcontroller.
I have now 2 problems with the results of this, I don't know how to fix.
How can i increase the height of pulley when closed?
When first initializing the drawer, it seems everything is being animated from the top left of the screen into position. Is there any way of preventing this?
Hi everyone!
Thank you for making this quite useful library.
I've played with it and I believe that any class that would like to conform to PulleyDrawerViewControllerDelegate
should not have to implement all the protocol functions.
It's simple to look into the source code and find what the default implementation for each methods is:
extension MyClass: PulleyDrawerViewControllerDelegate {
func collapsedDrawerHeight() -> CGFloat {
let kPulleyDefaultCollapsedHeight: CGFloat = 68.0
return kPulleyDefaultCollapsedHeight
}
func partialRevealDrawerHeight() -> CGFloat {
let kPulleyDefaultPartialRevealHeight: CGFloat = 264.0
return kPulleyDefaultPartialRevealHeight
}
func supportedDrawerPositions() -> [PulleyPosition] {
return PulleyPosition.all
}
}
Still, I believe that if I wanted to change only the behavior of collapsedDrawerHeight()
for example, I should be able to do just that.
This is just my opinion/suggestion, please feel free to dismiss it if it's not in line with your library development. ๐
Cheers,
Federico
I'm getting an exception when I try to switch to a pulleyViewController
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x143d485f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key drawerContentContainerView.
As per instructions, I added two container views in the pulleyviewcontroller and linked the outlet drawerContentContainer to a container view. And, I also linked the outlet primaryContentContainer to the other container view. These two container views segue to ordinary UIViewControllers.
I did not do any customization but I am getting this exception. My project is primilary objective-c but I don't think this has much to do with it. I even tried to use a forked project https://github.com/tadelv/Pulley/tree/objc_friendly but the exception still arises.
TLDR: followed insturctions to setup PulleyViewController in interface builder, NSUnknownKeyException arises
My app has a the Pully Drawer incorporated but from the background content view controller when I perform a segue to a separate View controller the drawer remains on the screen of the new view controller. Am I doing something wrong or is this an issue?
First of all, great library, thanks!
I wanted the drawer to open about half way and still make the background dim/darker. I tried using .partiallyRevealed state, but it didn't dim the background.
Then I tried using .open state and setting the -topInset value, so that the drawer would open only half way. But then the background dimming stopped working at certain values (topInset 200+) depending on device screen size.
What to do, to achieve my goal of opening the drawer to half screen and still dim the background?
Hi,
If you instantiate a pulley controller in interface builder there is an additional 8 height space between the vc top and the content drawer top. You can detect it by setting up a vc in storyboard and the replacing it by the same vc in code. The vc will then go down by 8.
If someone need a fix asap :
A workaround is to set again the content vc in viewWillAppear by code
So before getting into the meat of things, I dug through the old closed issues as I figured that I would find the reason as to why this seems to work on iOS 10 for iPad devices specifically.
Came across this closed issue where the UIVisualEffectView
implementation had changed with iOS 10 where I came across the same issue as well myself. https://github.com/52inc/Pulley/issues/5
I noticed that on actual device testing and on simulator as well (testing against iOS 9.3), the UIVisualEffectView
is broken on the UITableViewCells as the effect isn't being rendered.
Screenshots:
Wondering if the pre iOS 10 solution that worked on 9 could be used here with a conditional #available(<iOS Version here>)
would be a possible work around.
what's the best way to pass an array into pulley so that both drawer and primary can see it...
-Thanks
This would be the same as maps on iPad. Could not tell from the documentation and source if it is possible.
Other than this it is a great PulleyViewController API.
Thanks,
Orlando
[!] Error installing Pulley
[!] /usr/bin/git clone https://github.com/52inc/Pulley.git /var/folders/z6/y50mnb4s17n2wbtssvm0v9lr0000gn/T/d20160910-41184-h37c3q --template= --single-branch --depth 1 --branch 1.1.0
Cloning into '/var/folders/z6/y50mnb4s17n2wbtssvm0v9lr0000gn/T/d20160910-41184-h37c3q'...
warning: Could not find remote branch 1.1.0 to clone.
fatal: Remote branch 1.1.0 not found in upstream origin
Great work with Pulley!
I have a view that lies above both the primary and drawer container views in my Storyboard.
However, at run-time, the view appears underneath (in the view debugger) the containers, so I can't see them.
Is there any way to achieve this?
Thanks!
Here is my hierarchy:
PulleyDrawerViewController
|
--- MyController
|
--- UIScollview
|
---UIStackView
|
--- custom UIControl listening for vertical gesture
The issue is that whenever I try to start the UIControl gesture, my ScrollView scroll is triggered. So I excluded my UIcontrols by overriding touchesShouldCancel
for my UIScrollView. Now it works great when my scrollview is scrolled, but when not, the gesture is passed to Pulley's internal scrollview (that is private as you said in an other issue).
Do I have to fork / manual import the project to be able to modify the internal scrollview behavior or do you see anything else I can do to manage this case?
can this be added behind the tabbar instead of window?
Hi this time It's a more important bug :)
After dismissing a modal displayed over the pulley, the content drawer bugs.
I've managed to use only modal segues over full screen so it keeps my drawer so problem solved but when I don't manage my self the segue (Facebook login for ex) the bug stays. Think there is something to do with define context or something like this but I'm not expert with those.
I would like to do like Apple App Maps that When I click on Icon Details on the top it show new DrawerContentViewController overlay DrawerContentViewController default.
Hi, thanks for sharing such useful library.
I have found that when the I set the supported position without '.open', then the drawer UI will break and can not be dragged. Is this an issue?
Hallo first of all Thank you so much for this example it is very nice. So to the question how can i set the PullyDrawerView to enable for scrolling so the user must click a button too get back to normal mode ?
So i have it in open mode and have set a view in the PullyDrawerView (scrolling must be enable) then user must select more things and must click done and then drawer view get back to the normal mode with scrolling.
Thank you for your answer.
I have button on Primary Content View Controller . How can we open drawer content view controller on touch of the button.
I'm implementing the controls from IB and subclassed PulleyViewController and set the VC to my subclass in IB. But when I navigate to the VC, I get a crash:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7f9991607900> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key drawerContentContainerView.
Things run perfectly if I don't set the class to my subclass, but I need to subclass it to customize the drawer height.
Hi,
I have two drawer that have different collapsed size and I have no way to move the button in my primaryDrawer when the other one is loaded. It works asap I move the drawer but It is not considered as moved when its resized. I don't know if i'm clear enough.
In images :
The first one is the starting state spacing :
The second one is when I load a bigger collapsed size drawer :
If I move the drawer my buttons move with the drawerChangedDistanceFromBottom but then if I load again the first one :
I think one solution would be that drawerChangedDistanceFromBottom(_:distance:) in the primaryDelegate should be called when the pulleyController is changing his content drawer. Or add methods to the delegate to respond to the contentDrawer collapsed size changes.
Hey! I would like to access the primaryContentViewController of the PulleyViewController because I would like to pass some data over to the view. This should be done on the prepare(for segue: UIStoryboardSegue, sender: Any?)
method of the viewcontroller class, which presents Pulley modally (set up on storyboard).
I am facing the problem that the primaryContentViewController object on the appearing segue destination is nil and therefore I cannot pass data to it. Is there a way to get over this issue? I tried the same thing programmatically as well with no success. Here is my code (of the former attempt):
class MyVC: UIViewController {
@IBOutlet weak var textfield: UITextField!
@IBAction func tapped(_ sender: Any) {
performSegue(withIdentifier: "toPulley", sender: textfield.text)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let primaryContentVC = ((segue.destination as? PulleyViewController)?.primaryContentViewController as? PrimaryContentViewController), let data = sender as? String {
primaryContentVC.data = data
}
}
}
Please help with the question.
This situation, when I open the DrawerViewController in the state .open, then scrolling is disabled, if the number of cells can fit into the screen sizes. And accordingly I can not catch the event here:
func scrollViewDidScroll(_ scrollView: UIScrollView) {
self.searchBar.setShowsCancelButton(false, animated: false)
}
Hi the content and primary drawers are set to internal so we can't access it from outside of your project. Can you make these public or at least provide some getters ?
Is there another way to get reference to the primary from content or to the content from the primary ?
this is what i tried so far :
Hello guys. Thanks for sach amazing tool. have got two questions.
Thank you for attention.
First of all thank you for sharing this amazing library!
Would it be possible to more accurately imitate the animation in the iOS 10 Maps app when calling setDrawerContentViewController
?
There are two use cases that cause it:
May I know how to improve the nest scrolling behaviors?
For the case 2, I could improve it by setting UITableView.isScrollEnabled as false when contentOffset <= 0. I don't know if it is a good idea, but it just works like Apple Map.
I'm a bit new to iOS dev, I'm writing my program in objective c and I used pods to install Pulley using the use_frameworks! flag. I can find PulleyDelegate but I cannot find PulleyDrawerViewControllerDelegate. I'm trying to follow your instructions to change the drawer dimensions dynamically. I imported the framework using #import "Pulley-Swift.h"
Hi,
sorry for these easy questions but im a bloody beginner :)
I want to customize the collapsed height of the drawer. So far i implemented the PulleyDrawerViewControllerDelegate protocol in the DrawerContentVC and added inside the class the three functions
func collapsedDrawerHeight() -> CGFloat {
}
func partialRevealDrawerHeight() -> CGFloat {
}
func supportedDrawerPositions() -> [PulleyPosition]{
}
what do i have to type inside these functions to set the collapsed Drawer Height twice as big as the height of my Tabbar ?
Thanks in advance :)
Hi,
As you recommended to not inherit from pulleyViewController directly how should we react for navigation controller bar button items ?
I'm gonna start by using buttons but I think its something useful
Is there any chance to put drawer on top of view (below navigation bar) and drag it down (instead of its initial bottom position)? and it it is, how?
thanks
The Apple Maps bottomView handles transitioning from the pan gesture to the scroll view scroll gesture in one smooth motion. the user doesn't need to stop one gesture and start a new one in order to start scrolling the view.
I am trying to set pulley view controller as a root view controller of navigation controller. I wish to manage the extra top 44 space of bar as Drawer Container VC flows on top of bar which i don't want. Could you please help me with this?
Is it possible to add a drawer over the first drawer? This is the behaviour of the Map-App in iOS, which I want to implement.
I am trying to path a variable from my view controller to pulley.
I managed to pass it to PulleyViewController using prepareForSegue method.
but I cant understand how to pass it to PrimaryViewController and DrawerViewController.
Can you please help me? Thanks
Summary:
The drawer is dropping and staying below where it is supposed to go.
When I start the app, the drawer is in the right position, but when I move the pulley up, let go, and then down all the way, it shows less than when it started.
What it should do:
The pulley should get back to the original position.
Details:
collapsedDrawerHeight = partialRevealDrawerHeight
and
supportedDrawerPositions = PulleyPosition.all
First of all thank you for sharing this amazing library!
I've noticed a strange behavior that is probably unwanted in most cases; if you tap the status bar while the drawer is open, the scroll view scrolls to the top, effectively closing the drawer without getting rid of the dimming view, meaning that you have to tap once more to interact with the content view.
This can be solved by setting drawerScrollView.scrollsToTop = false
Hi, how present only drawerViewController from any rootViewController ? Without PulleyViewController. I think that will awesome.
What would be the ideal way to display the drawer content over that tabBar
of a UITabBarController
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.