Skip to content

Commit

Permalink
Fix iOS9- crash issues;
Browse files Browse the repository at this point in the history
  • Loading branch information
cuzv committed Apr 7, 2017
1 parent 9e41f71 commit b67dba6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@
### 0.2.2

- Fixed typo;
- Use macro;
- Use macro;

### 0.2.3

- Fix available issue for iOS10 lower versions.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/cuzv/RRNavigationBar/blob/master/LICENSE)
[![CocoaPods Compatible](https://img.shields.io/badge/CocoaPods-v0.2.2-green.svg)](https://github.com/CocoaPods/CocoaPods)
[![CocoaPods Compatible](https://img.shields.io/badge/CocoaPods-v0.2.3-green.svg)](https://github.com/CocoaPods/CocoaPods)
[![Weibo](https://img.shields.io/badge/Weibo-cuzval-yellowgreen.svg)](http://weibo.com/cuzval/)
[![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](http://twitter.com/mochxiao)

Expand Down
21 changes: 17 additions & 4 deletions Sources/UINavigationController+RRNavigationBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,29 @@ - (void)navigationController:(UINavigationController *)navigationController will
}

// If cancel pop, needs recover.
__weak typeof(self) weak_self = self;
static dispatch_once_t onceToken;
static BOOL iOSVersionGreaterThanOrEqualTo10 = NO;
dispatch_once(&onceToken, ^{
iOSVersionGreaterThanOrEqualTo10 = UIDevice.currentDevice.systemVersion.floatValue >= 10;
});
id <UIViewControllerTransitionCoordinator> transitionCoordinator = self._visibleTopViewController.transitionCoordinator;
[transitionCoordinator notifyWhenInteractionChangesUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
__weak typeof(self) weak_self = self;
void (^handleCancel)(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) = ^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
if (context.isCancelled) {
RRLog(@"Canceled");
__strong typeof(weak_self) strong_self = weak_self;
[strong_self _handleDidShowViewController:strong_self._visibleTopViewController];
}
}];

};
if (iOSVersionGreaterThanOrEqualTo10) {
[transitionCoordinator notifyWhenInteractionChangesUsingBlock:handleCancel];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[transitionCoordinator notifyWhenInteractionEndsUsingBlock:handleCancel];
#pragma clang diagnostic pop
}

viewController.rr_navigationBar._rr_transiting = YES;
viewController.rr_navigationBar._rr_equalOtherNavigationBarInTransiting = NO;
viewController.rr_navigationBar.hidden = NO;
Expand Down

0 comments on commit b67dba6

Please sign in to comment.