diff options
author | v.mikhaylenko <v.mikhaylenko@corp.mail.ru> | 2015-06-29 17:17:31 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:53:16 +0300 |
commit | 1864e76a651a1e4a071da97b97445dc3458fde1e (patch) | |
tree | ed3b13c386f13589902c6726bd788845d6921c72 /iphone/Maps/Classes/UIViewController+Navigation.mm | |
parent | 04c8abd86cf9cb723025709efa6ecae542b19f4c (diff) |
[ios] Fixes layout in place page and navigation bar.
Diffstat (limited to 'iphone/Maps/Classes/UIViewController+Navigation.mm')
-rw-r--r-- | iphone/Maps/Classes/UIViewController+Navigation.mm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/iphone/Maps/Classes/UIViewController+Navigation.mm b/iphone/Maps/Classes/UIViewController+Navigation.mm index ff26e3026e..0945836629 100644 --- a/iphone/Maps/Classes/UIViewController+Navigation.mm +++ b/iphone/Maps/Classes/UIViewController+Navigation.mm @@ -6,18 +6,24 @@ - (void)showBackButton { - UIBarButtonItem * leftItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"NavigationBarBackButton"] style:UIBarButtonItemStylePlain target:self action:@selector(backButtonPressed:)]; + 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)backButtonPressed:(id)sender +- (void)backTap { [self.navigationController popViewControllerAnimated:YES]; } - (UIStoryboard *)mainStoryboard { - NSString * name = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? @"Main_iPad" : @"Main_iPhone"; + NSString * name = IPAD ? @"Main_iPad" : @"Main_iPhone"; return [UIStoryboard storyboardWithName:name bundle:nil]; } |