Skip to content

Commit

Permalink
Possible fix for andreamazz#16
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Nov 23, 2014
1 parent f58a23c commit baf1cc1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions AMWaveTransition/AMWaveTransition.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ - (void)handlePan:(UIScreenEdgePanGestureRecognizer *)gesture

// Controller that will be visible after the pop
UIViewController<AMWaveTransitioning> *toVC;
int index = (int)[navigationController.viewControllers indexOfObject:navigationController.topViewController];
NSInteger index = [navigationController.viewControllers indexOfObject:navigationController.topViewController];
// The gesture velocity will also determine the velocity of the cells
float velocity = [gesture velocityInView:navigationController.view].x;
CGPoint touch = [gesture locationInView:navigationController.view];
if (index == 0) {
// Simple attach animation
touch.x = 0;
toVC = nil;
} else {
} else if (index != NSNotFound) {
toVC = (UIViewController<AMWaveTransitioning> *)navigationController.viewControllers[index-1];
}

Expand Down Expand Up @@ -467,15 +467,21 @@ - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionC
}];
}

- (NSArray*)visibleCellsForViewController:(UIViewController*)viewController {
- (NSArray *)visibleCellsForViewController:(UIViewController*)viewController
{
NSArray *visibleCells = nil;

if ([viewController respondsToSelector:@selector(visibleCells)]) {
visibleCells = ((UIViewController<AMWaveTransitioning>*)viewController).visibleCells;
} else if ([viewController respondsToSelector:@selector(tableView)]) {
visibleCells = ((UITableViewController*)viewController).tableView.am_visibleViews;
}
return visibleCells.count ? visibleCells : @[viewController.view];
if (visibleCells.count) {
return visibleCells;
} else if (viewController.view) {
return @[viewController.view];
}
return nil;
}

@end
Expand Down

0 comments on commit baf1cc1

Please sign in to comment.