0
#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupTopBar];
}

- (BOOL)prefersStatusBarHidden {
    return YES;
}

- (void)setupTopBar {

    UINavigationBar *navigationBar = self.navigationController.navigationBar;
    navigationBar.tintColor = [UIColor whiteColor];

    [navigationBar setBackgroundImage:[UIImage imageNamed:@"topbar_bg_black_1px"] forBarMetrics:UIBarMetricsDefault];

    self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"topbar_logo"]];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"topbar_icon_menu"]
                                                                             style:UIBarButtonItemStylePlain
                                                                            target:nil
                                                                            action:nil];
}

@end

Print out here: http://goo.gl/y0buK1 Topbar portrait height is bigger than topbar landscape height everywhere except iPhone 6 Plus. How make topbar landscape height to be equal topbar potrait height?

github: https://github.com/test1215/proto1

  • 2
    This is standard iOS behavior. You don't make them the same. There's less room in landscape so the navber isn't as tall. – rmaddy Mar 17 '15 at 06:18
  • but my art-designer don't like standart bahavior ))) – whiteRussian Mar 17 '15 at 07:09
  • Can I make them the same? – whiteRussian Mar 17 '15 at 07:17
  • 1
    @whiteRussian you may create your custom bar without using UINavigationBar with preferred behavior – Azat Mar 17 '15 at 07:36
  • thanks, @Azat. perhaps it'll the best way – whiteRussian Mar 17 '15 at 13:53
  • Seems your "art-designer" shouldn't apply for a job at Apple. First ask your "art-designer" whether they really want to go deliberately against Apple's user interface guidelines. If they say yes, ask your product manager if they want a design that goes deliberately against Apple's user interface guidelines, and whether they think that customers will be happy about it. – gnasher729 Dec 02 '15 at 10:41

1 Answers1

1

I think your art designer is a moron who never read Apple HIG and/or thinks he knows better. Which he obviously does not (Something heavy just got off my chest). That being said and professional qualities and merits of your art guy aside (which merits a separate discussion with s.o. not being the best venue for flamewars and trolling) I'll probably end up having a custom navigation bar myself. Solely because stock UINavigationItem can't pull arbitrarily sized png over UIBarButtonItem.image (it has to be 22x22 44x44 and 66x66 per HIG).

Not sure if it helps. But I just HAD to comment on the professional qualities of the fine folks in the IT industry you are likely to run into outside the confines of US of A. I guess most of americans here are either too polite and/or bound by the decease of political correctness. Coming from the cultural background that does not tether me to the domain of PC I can safely comment on the root cause of your troubles with the navbar: the human factor.

Anton Tropashko
  • 5,486
  • 5
  • 41
  • 66