Welcome to mirror list, hosted at ThFree Co, Russian Federation.

UIViewController+Navigation.mm « Classes « Maps « iphone - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0945836629bf0af80ed346f6ca9452954ca5f191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#import "Common.h"
#import "UIKitCategories.h"
#import "UIViewController+Navigation.h"

@implementation UIViewController (Navigation)

- (void)showBackButton
{
  UIImage * backImage = [UIImage imageNamed:@"NavigationBarBackButton"];
  CGFloat const imageSide = backImage.size.width;
  UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(0., 0., imageSide, imageSide)];
  [button setImage:backImage forState:UIControlStateNormal];
  [button addTarget:self action:@selector(backTap) forControlEvents:UIControlEventTouchUpInside];
  button.imageEdgeInsets = UIEdgeInsetsMake(0., -imageSide, 0., 0.);
  UIBarButtonItem * leftItem = [[UIBarButtonItem alloc] initWithCustomView:button];
  self.navigationItem.leftBarButtonItem = leftItem;
}

- (void)backTap
{
  [self.navigationController popViewControllerAnimated:YES];
}

- (UIStoryboard *)mainStoryboard
{
  NSString * name = IPAD ? @"Main_iPad" : @"Main_iPhone";
  return [UIStoryboard storyboardWithName:name bundle:nil];
}

@end