diff options
author | Ilya Grechuhin <i.grechuhin@mapswithme.com> | 2015-06-04 11:09:53 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:49:52 +0300 |
commit | 8891fcd36962f05784acf2f6f3616a9bca169b4b (patch) | |
tree | 7b2a77313722508b2845a3c58087c78e52cbdae1 /iphone/Maps/Classes/UIViewController+Navigation.mm | |
parent | 566a9545774766b3914b757f7ba2f0672f6698fc (diff) |
Added overload for version check.
Diffstat (limited to 'iphone/Maps/Classes/UIViewController+Navigation.mm')
-rw-r--r-- | iphone/Maps/Classes/UIViewController+Navigation.mm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/iphone/Maps/Classes/UIViewController+Navigation.mm b/iphone/Maps/Classes/UIViewController+Navigation.mm new file mode 100644 index 0000000000..c5a4a17c69 --- /dev/null +++ b/iphone/Maps/Classes/UIViewController+Navigation.mm @@ -0,0 +1,30 @@ +#import "Common.h" +#import "UIKitCategories.h" +#import "UIViewController+Navigation.h" + +@implementation UIViewController (Navigation) + +- (void)showBackButton +{ + UIButton * backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 56, 44)]; + [backButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; + [backButton setImage:[UIImage imageNamed:@"NavigationBarBackButton"] forState:UIControlStateNormal]; + + UIBarButtonItem * space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; + space.width = isIOSVersionLessThan(7) ? -8 : -16; + UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:backButton]; + self.navigationItem.leftBarButtonItems = @[space, item]; +} + +- (void)backButtonPressed:(id)sender +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +- (UIStoryboard *)mainStoryboard +{ + NSString * name = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? @"Main_iPad" : @"Main_iPhone"; + return [UIStoryboard storyboardWithName:name bundle:nil]; +} + +@end |