0

I'm curious why this code won't work:

#if UI_USER_INTERFACE_IDIOM//() == UIUserInterfaceIdiomPad
@implementation UINavigationBar (Custom height)

- (CGSize)sizeThatFits:(CGSize)size {
    CGSize newSize = CGSizeMake(self.frame.size.width,44+BreadCrumbBarHeight-1);
    return newSize;
}    

@end
#endif

Any ideas?

Johannes Lund
  • 1,897
  • 2
  • 19
  • 32
  • possible duplicate of http://stackoverflow.com/questions/2576356/how-does-one-get-ui-user-interface-idiom-to-work-with-iphone-os-sdk-3-2 – elp Mar 08 '12 at 11:44

1 Answers1

4

UI_USER_INTERFACE_IDIOM() is a macro designed (and defined) for runtime evaluation! Using it for compile-time evaluation will fail.

It is defined as:

#define UI_USER_INTERFACE_IDIOM() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] ? [[UIDevice currentDevice] userInterfaceIdiom] : UIUserInterfaceIdiomPhone)

the call [UIDevice.. will FAIL at compile-time evaluation

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217