Comments (8)
Hi @panzerdp ,
Thanks for your bug report. I've tested for some cases, then I found that interactiveGestureRecognizer
cancels navigation button's touch event. I just add some code that enables navigation button highlighting.
- Patch commit: f1bba03
- New version on CocoaPods: SwipeBack 1.0.2
from swipeback.
Hi @devxoul,
thanks for your quick answer and fix.
I installed the 1.0.2 version and the custom back button is highlighted, but... the swipe back is not working. What could be the problem?
Tested in iOS 8 simulator, Xcode 6.2 beta, built using Swift.
Thanks.
from swipeback.
I tested in iOS 8 simulator with Xcode 6.1 and works fine. I've just downloaded Xcode 6.2 beta, and gonna test again. While testing, how about check this demo project? It's still in progress but you can test with environment that I developed in. Thanks.
from swipeback.
I found something strange that SwipeBack 1.0.2 installed via CocoaPods doesn't work properly. I removed calling load
of super then works fine. I released 1.0.3 version, check for these:
- Patch commit: a5df3ae
- New version on CocoaPods: SwipeBack 1.0.3
Thank you.
from swipeback.
I installed the 1.0.3 version and it works better.
In my case I have a back button with custom background image only, without text and unfortunately it is not highlighted. When using a simple button with text, it does highlight.
I checked also the demo version, it works well with textual back button, but no example with background image.
Thanks.
from swipeback.
I searched more in the code and managed to find a solution.
It seems like you highlight the UINavigationButton, as a descendant of the Navigation Bar. But in my particular case, I have a UIButton in navigation button, which catches the gesture. I've added the highlight to UIButton, and it works correct.
I've updated UINavigationController+SwipeBack.m
with the following:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
Class UINavigationButton = NSClassFromString(@"UINavigationButton");
Class UIButtonClass = NSClassFromString(@"UIButton");
if (([touch.view isKindOfClass:UINavigationButton] || [touch.view isKindOfClass:UIButtonClass]) && [touch.view isDescendantOfView:self.navigationBar]) {
UIButton *button = (id)touch.view;
button.highlighted = YES;
}
return YES;
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
CGPoint location = [gestureRecognizer locationInView:self.navigationBar];
UIView *view = [self.navigationBar hitTest:location withEvent:nil];
Class UINavigationButton = NSClassFromString(@"UINavigationButton");
Class UIButtonClass = NSClassFromString(@"UIButton");
if (([view isKindOfClass:UINavigationButton] || [view isKindOfClass:UIButtonClass]) && [view isDescendantOfView:self.navigationBar]) {
UIButton *button = (id)view;
button.highlighted = NO;
}
return YES;
}
I made some initial tests, it seems to work correct.
Let me know what you think.
Thanks.
from swipeback.
Cool. Since UINavigationButton
is a subclass of UIButton
, so we can just put this code instead:
if ([view isKindOfClass:[UIButton class]] && [view isDescendantOfView:self.navigationBar]) {
...
}
I just released 1.0.4 to CocoaPods.
Thank you for your time @panzerdp :D
from swipeback.
Agreed, we can use UIButton.
Thanks for your time too. I'm glad to have this working :)
from swipeback.
Related Issues (8)
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 swipeback.