g763007297 / gqgesvctransition Goto Github PK
View Code? Open in Web Editor NEW一句话添加滑动手势返回,完美与ScrollView兼容,可自定义滑动返回范围。
License: MIT License
一句话添加滑动手势返回,完美与ScrollView兼容,可自定义滑动返回范围。
License: MIT License
- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)recognizer
{
//取消scrollview上面的自带手势
if (__GQGesRequestFailLoopScrollView && !self.disableVCTransition && !recognizer.__GQGesVCTransition_NavController) {
UIView *cell = [recognizer view];
CGPoint velocity = [recognizer velocityInView:cell];
NSLog(@"velocity.x%f velocity.y%f",velocity.x,velocity.y);
//如果scrollview滑动到左边界并且是往左滑
CGPoint translation = [recognizer translationInView:cell];
if (translation.x == 0) {
return YES;
}
if (self.contentOffset.x<=0 && velocity.x>=0) {
CGFloat ratio = (fabs(translation.x)/fabs(translation.y));
if ((translation.y>=0&&ratio>0.618f)||(translation.y<0&&ratio>0.2f)) {
return NO;
}
}
}
return YES;
}
velocity一行断点出现报错,崩溃。
2017-09-07 10:24:33.240168 Demo[2262:525120] velocity.x-1335.216436 velocity.y-306.443297
2017-09-07 10:24:33.240707 Demo[2262:525120] velocity.x-1335.216436 velocity.y-306.443297
可能是越界了
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.