Skip to content

Instantly share code, notes, and snippets.

@xandrucea
Last active December 18, 2015 15:19
Show Gist options
  • Save xandrucea/5803889 to your computer and use it in GitHub Desktop.
Save xandrucea/5803889 to your computer and use it in GitHub Desktop.
Device identification
check if device is jailbraiked
(Not all users have installed Cydia, maybe check any root dir outside the sandbox -->/bin/usr)
------------------------------
NSString *filePath = @"/Applications/Cydia.app";
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath])
{
// do something useful
}
CGSize *screenSize = [[UIScreen mainScreen] bounds].size;
if(screenSize.height > 480.0f){
[self setShadowForButton:aButton];
NSLog(@"Im an iPhone 5");
}
init classes and call implicit xib files
-----------------------------------------
- (id)init{
NSString *nibName;
if(self){
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
nibName = @"EntryViewController";
}else{
nibName = @"EntryViewController~iPad";
}
}
return [self initWithNibName:nibName bundle:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment