Skip to content

Instantly share code, notes, and snippets.

@steipete
Created May 29, 2011 12:52
Show Gist options
  • Save steipete/997756 to your computer and use it in GitHub Desktop.
Save steipete/997756 to your computer and use it in GitHub Desktop.
// this is implemented, but not declared. we add the category to fix the warning
// (since super cannot be casted any longer in clang)
@interface UINavigationController(AMInternal)
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item;
@end
@implementation AMNavigationController
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - UINavigationBarDelegate
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item {
static BOOL change_once = NO;
if (!change_once && isIPad()) {
change_once = YES;
CATransition* transition = [CATransition animation];
transition.duration = kAMGridFadeAnimationDuration;
transition.type = kCATransitionFade;
transition.subtype = kCATransitionFromTop;
[self.view.layer addAnimation:transition forKey:kCATransition];
[self popViewControllerAnimated:NO];
//[navigationBar popNavigationItemAnimated:NO];
return NO;
}else {
change_once = NO;
[super navigationBar:navigationBar shouldPopItem:item];
return YES;
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment