Comments (4)
if don't need physical effect, you don't need to use UIDynamic. Use uiview.animateWithDuration function to change position of the side menu container in the toggleMenu function.
from enswiftsidemenu.
Yeah, sound simple, but cant get it. Can you help me to remove bounce using UIDynamic?
As i know, all magic is here:
private func toggleMenu (shouldOpen: Bool) {
animator.removeAllBehaviors()
isMenuOpen = shouldOpen
let gravityDirectionX: CGFloat = (shouldOpen) ? 0.5 : -0.5;
let pushMagnitude: CGFloat = (shouldOpen) ? 60.0 : -60.0;
let boundaryPointX: CGFloat = (shouldOpen) ? menuWidth : -menuWidth-1.0;
let gravityBehavior = UIGravityBehavior(items: [sideMenuContainerView])
gravityBehavior.gravityDirection = CGVectorMake(gravityDirectionX, 0.0)
animator.addBehavior(gravityBehavior)
let collisionBehavior = UICollisionBehavior(items: [sideMenuContainerView])
collisionBehavior.addBoundaryWithIdentifier("menuBoundary", fromPoint: CGPointMake(boundaryPointX, 20.0),
toPoint: CGPointMake(boundaryPointX, sourceView.frame.size.height))
animator.addBehavior(collisionBehavior)
let pushBehavior = UIPushBehavior(items: [sideMenuContainerView], mode: UIPushBehaviorMode.Instantaneous)
pushBehavior.magnitude = pushMagnitude
animator.addBehavior(pushBehavior)
let menuViewBehavior = UIDynamicItemBehavior(items: [sideMenuContainerView])
menuViewBehavior.elasticity = 0.3
animator.addBehavior(menuViewBehavior)
}
from enswiftsidemenu.
There is no need to use the UIDynamic framework
private func toggleMenu (shouldOpen: Bool) {
isMenuOpen = shouldOpen
let destFrame = CGRectMake((shouldOpen) ? 0 : -menuWidth, 0, menuWidth, sideMenuContainerView.frame.size.height)
UIView.animateWithDuration(0.4, animations: { () -> Void in
self.sideMenuContainerView.frame = destFrame
})
}
from enswiftsidemenu.
Man, i called THIS "REAL SUPPORT!".
Thank you for so fast answer! Hope your advice will be helpful for other people!
from enswiftsidemenu.
Related Issues (20)
- Tableview frame
- When I go back my previous screen data of text field disappears
- Issue when adding subviews
- Cocoapods needs update HOT 1
- crash on outside call
- When swipe disabled, pan not working.
- How to decrease the width of side menu and how to change the appearance of main view controller ?
- Logout screen HOT 5
- How to change navigation bar color for specific view controller?
- Can not add side menu from storyboard.
- How to adapt ENSwiftSideMenu to iPad HOT 1
- menu swipes from left when logout
- how can we change menu items?
- // TODO: add blur for ios 7
- Covering TabBar? HOT 1
- How to disable menu open pan gestures for other views except one view HOT 3
- Download Swift 4 Version
- Navigate to back pop view controller ??
- side menu not open
- How to reload sidemenu view
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 enswiftsidemenu.