Skip to content

Instantly share code, notes, and snippets.

@advantis
Created September 7, 2012 13:11
Show Gist options
  • Save advantis/3666158 to your computer and use it in GitHub Desktop.
Save advantis/3666158 to your computer and use it in GitHub Desktop.
Easy user interface idiom detection
//
// Copyright © 2012 Yuri Kotov
//
extern BOOL ADVUserInterfaceIdiomIsPhone;
//
// Copyright © 2012 Yuri Kotov
//
BOOL ADVUserInterfaceIdiomIsPhone = NO;
__attribute__((constructor))
static void ADVUserInterfaceIdiomInit()
{
@autoreleasepool
{
ADVUserInterfaceIdiomIsPhone = (UIUserInterfaceIdiomPhone == [[UIDevice currentDevice] userInterfaceIdiom]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment