Latest | 1.1 |
---|---|
Homepage | https://github.com/hoppenichu/HCPopBackGestureProxy |
License | MIT |
Platforms | ios 7.0, requires ARC |
Authors |
From iOS7, we can go back (popViewController) by swiping the view edge.
However, this doesn’t work when customView is set to navigationItem.leftBarButtonItems
.
I found a solution here, but it likely to crash when swiping during popViewController
animation (I found Pinterest v.3.7 also has this bug).
Additionally, I think this solution is difficult for almost all apps to apply, because they might not have a root class of UINavigationController
.
This library is an improvement of the solution above.
Usage
Just set viewController to sharedInstance at viewDidAppear
.
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[HCPopBackGestureProxy sharedInstance].viewController = self;
}
and, call viewWillDisappear at viewWillDisappear
.
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[HCPopBackGestureProxy sharedInstance] viewWillDisappear];
}
If you want to disable this gesture partly, implement the protocol method and return NO like below.
- (BOOL)hcPopBackGestureProxyShouldBegin:(UIGestureRecognizer *)recognizer {
// do something...
return NO;
}
Installation
HCPopBackGestureProxy is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'HCPopBackGestureProxy'
Requirement
- iOS6 or later
- ARC
License
HCPopBackGestureProxy is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "HCPopBackGestureProxy", "version": "1.1", "source": { "git": "https://github.com/hoppenichu/HCPopBackGestureProxy.git", "tag": "1.1" }, "summary": "Enables iOS7 or later swipe-back gesture easily.", "homepage": "https://github.com/hoppenichu/HCPopBackGestureProxy", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "Takeru Chuganji": "[email protected]" }, "platforms": { "ios": "7.0" }, "requires_arc": true, "source_files": "HCPopBackGestureProxy" }
Sat, 12 Mar 2016 10:34:03 +0000