zoonooz / zfdragablemodaltransition Goto Github PK
View Code? Open in Web Editor NEWCustom animation transition for present modal view controller
License: MIT License
Custom animation transition for present modal view controller
License: MIT License
In order to be able to get the latest fixes in cocoapods
In my case, a tab bar and navigation bar based app.
When dismissing a viewcontroller with the ZFDragableModalTransition, the status bar is removed from the toViewController
which is the TabBarController
during the transition, and will show when the transition is complete.
so you can see the navigationbar grows from 44pt to 64pt immediately.
Hi,
I am using the latest master branch with the fullsScreen transition implemented.
My view hierarchy is the following :
UITabBarController -> (the following number represents the tabs)
1 -> UINavigationController -> UIViewController (we will call it A)
2 -> ...
3 -> ...
4 -> ...
Inside the UIViewController A I am calling ZFDragableModalTransition with the following code to show another UIViewController B as modal
var ctrl = self.storyboard?.instantiateViewControllerWithIdentifier("XXXXXXX") as! XXXXX
ctrl.delegate = self
ctrl.modalPresentationStyle = .FullScreen
self.animator = ZFModalTransitionAnimator(modalViewController: ctrl)
self.animator.dragable = false
self.animator.bounces = false
self.animator.direction = ZFModalTransitonDirection.Bottom;
self.animator.transitionDuration = 0.66
self.animator.behindViewAlpha = 0.5
self.animator.behindViewScale = 0.5
ctrl.transitioningDelegate = self.animator
self.presentViewController(ctrl, animated: true, completion: nil)
Once the transition is done I am getting the following notice/warning in the console :
Unbalanced calls to begin/end appearance transitions for <UITabBarController: 0x155d48cd0>.
The same message appears when I called the following code inside the A UIViewController to dismiss the modal view B
self.dismissViewControllerAnimated(true, completion: nil)
Any idea where it comes from ?
Tested on: iOS 8.1
Changing bounces
to NO
results in the same presentation animation as if it were set to YES
(presented from the bottom). Am I missing something or is that property intended for something else?
Hey,
my modal vc in this case is an horizontal page view controller.
If i set the draggable option as true(which i want) im not able to use any gestures that i used in my vc,
including the page view slide gesture.
Any ideas, or solutions?
Thanks
When I present the modalVC from the fromVC, it looks perfect.
but when I dismiss the modalVC (use drag gesture or call dismiss method), as soon as the dismiss animation finished, my fromVC is also disappeared, just left a gray background color.
Did I do anything wrong about this? What's the problem?
Thank you very much.
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == SEGUES.SegueLobbyToProfile {
if let child = segue.destinationViewController.contentViewController as? ProfileViewController{
self.animator = ZFModalTransitionAnimator(modalViewController: child)
self.animator!.bounces = true
self.animator!.transitionDuration = CGFloat(0.8)
self.animator!.direction = .Right
self.animator!.setContentScrollView(child.scrollView)
self.animator!.dragable = true
child.modalPresentationStyle = .Custom
child.transitioningDelegate = self.animator
}
}
}
Is this the correct way to attach the animator to the segue? My segue is "present modally" , with everything on default.
When the animator appears, it comes from Bottom (instead of Right), and the screen is completely white. I can drag the animator down to close it.
Hi,
I'm having an issue when a phone call gets in and you are in the middle of a transition..
I'm still trying to find why this happen .
Please add support for Landscape. Demo currently only works on Portrait.
As the subject, How to scroll my ViewController for a webview inside with the draggable effect enable ?
As seen in the gif, I was the model view controller to cover 75% of screen but the one in demo covers the entire screen. How can I modify that? I have tried setting the frame size but that didnt fix the issue.
thanks
When I drag the modal down to dismiss but then change my mind, I let go and it shows the status bar, even though I return true
for prefersStatusBarHidden
.
Please update this or create another repo with a swift version.
Please update CocoaPods spec I'm not able to use @Property CGFloat transitionDuration;
If I want to use in ios6, how should I modify?thanks~
The demo gif shows semi modal view presentation, how do I you replicate this?
Anyone have same problem?
How can I set it so that the user can still drag the view controller even if scrollView isn't scrolled all the way to the top?
I'm using a tableView in the modal, and it only takes up the bottom half of the screen, so it seems rather tedious for the user to scroll all the way to the top of the scrollview just to push the controller down.
Hello, thank you for your transition.
Can you explain how I can disable bounce effect when modal view appears. As I understood bounce property for another thing.
Thank you.
When pushing a NavigationView controller, with a view controller that has a scrollview
and setting
[self.animator setContentScrollView:detailViewController.scrollview];
disables the scroll view scrolling
any ideas?
hi,thanks for this great lib.. and I am doing a project like your demo gif showing.
and How can show a view from bottom like your demo gif, only show "a part of" view
The code I present VC1 to VC2 is the same as your demo and not any network request exist but When I dismiss VC2 to VC1 there always has a few seconds delay.
Is there any way to disable certain gesture directions when the modal has been presented
i.e. I only want to allow the user to drag the modal down to dismiss and not allow the pull up bounce gesture as it interferes with other things in my modal
Cheers
Setting bounces to NO doesn't appear to change anything - the modal view still bounces in.
I would like to make a semi transparent view of background black (around 75% alpha), and put a webview on top of it, how can I make the content of webview to be solid? I tried to add html body style: rgba(0,0,0,1) for that web view content font color. However not works. The content text still in semi transparent... any idea?
Run the demo and change the draggable switch and it crashes. Selector not found.
Hello,
First nice work, it's a pretty cool lib.
But I got an issue trying to make it work on iPhone 6. I was using Xib, and the view of the modal controller did not resize correctly (using AutoresizingMask or Auto-Layout). But it was able to make it work with a Storyboard.
I tried the exact same thing by converting your demo project and saw the exact same behavior.
I am working on an app with swift , I was trying to use this lib with Objective-C bridge , and after I present the view controller , whenever I drag to dismiss the viewcontroller it will crash ? what is wrong? do you have any idea ?
in my case Xcode6.2 , ios 8.2
i use in swift without uiscrollview is working, but if got uiscrollview it would not working
below is my code
modalView = cn_web()
self.animator = ZFModalTransitionAnimator(modalViewController:modalView)
self.animator.setContentScrollView(modalView!.sv)
self.animator.dragable = true
self.animator.direction = ZFModalTransitonDirection.Right
self.animator.bounces = false
self.animator.behindViewAlpha = 0.1;
self.animator.behindViewScale = 0.93;
self.animator.transitionDuration = 0.3;
modalView!.modalPresentationStyle = UIModalPresentationStyle.FullScreen
modalView!.transitioningDelegate = self.animator
Is it possible to make interactive presentation using this component w/o changing its code?
Here is the detail:
A : fromViewController
B : toViewController, is a UINavigationController object
C : a viewController
When present B, i can use back gesture (A.Animator.dragable = YES) back to A, it works perfectly.
When present B, then push C to B, i can use back gesture on C too, it is supposed to back to B, but it bring me back to A. Only if i slide from the edge of the screen i can back to B.
I tried to change A.Animator.dragable property to NO after push C, but the C would not response anything.
How achieve the modal appearing just over X% of the screen as seen on the gif below?
https://raw.githubusercontent.com/zoonooz/ZFDragableModalTransition/master/Screenshot/ss.gif
If you start dragging the window closed, release it so that it's back open, and then try and use anything that triggers
self.dismissViewControllerAnimated(true, completion: nil)
You get this error
Warning: Attempt to dismiss from view controller <UINavigationController:
0x144510fa0> while a presentation or dismiss is in progress!
It appears as if the view has not been canceled form it's transition after the drag is released.
When you open modal in portrait or landscape and dismiss it with another rotation mode, the layout will be mess.
I have a getting error if i start dragging the modalviewcontroller
My code to present modal view controller is like this
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
VideoModel* videoObj = [videos objectAtIndex:indexPath.row];
self.selectedVideo = videoObj;
[self performSegueWithIdentifier:@"home_to_video" sender:nil];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
VideoViewController *detailViewController = segue.destinationViewController;
self.animator = [[ZFModalTransitionAnimator alloc] initWithModalViewController:detailViewController];
self.animator.dragable = TRUE;
self.animator.direction = ZFModalTransitonDirectionBottom;
detailViewController.transitioningDelegate = self.animator;
detailViewController.modalPresentationStyle = UIModalPresentationCustom;
}
The modal window is shown correctly with animation, just gives error on dragging.
I am testing it on ios7.
The error which I get is
Warning: Attempt to present <VideoViewController: 0xc0a69b0> on <UITabBarController: 0xc0676c0> while a presentation is in progress!
Is it possible to dismiss by scrolling until the end just like if we would scroll at the beginning?
Please ;)
How detect when click done button or dragable
[self dismissViewControllerAnimated:YES completion:nil];
and call -(void)viewWillAppear:(BOOL)animated ?
Transition from top to bottom and close pulling down!...
Transition fade in and fade out!...
=)
Not sure if this could be a specific error to my app but I'm getting this full error message
"Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan inf]"
I am using the modal transition to a uitableview and adding uitableview to [self.animator setContentScrollView:detailViewController.tableView];
If there is any clue on how i might be able to change this i could push it as a fix. but if you think its a simple thing to change it would really help my app. I plan to release it soon!
Great job on this wonderful control!
It could be nice to adding this feature :)
First off, great library!
I've got this one particular issue - once my modal view controller opens up, and I scroll down (to see the end content), when I scroll back up, the transition does not kick in - instead, the UIScrollView "bounces" at the top.
How can I prevent that over scroll at the top and trigger the modal transition?
Can someone give me an example of how to do the exact animation shown in the GIF where the bottom view only covers like 80% of the view (more of a push segue, and less of a modal one).
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.