Skip to content

Instantly share code, notes, and snippets.

@Gi-lo
Created November 30, 2012 08:18
Show Gist options
  • Save Gi-lo/4174484 to your computer and use it in GitHub Desktop.
Save Gi-lo/4174484 to your computer and use it in GitHub Desktop.
iPad/iPhone specific code
On_iPhone(^{
// Some iPhone only code
});
On_iPad(^{
// Some iPad only code
});
or:
if ([UIDevice isIPhone]) {
// Some iPhone only code
}
if ([UIDevice isIpad]) {
// Some iPad only code
}
@mrgrauel
Copy link

The if statement is better in my opinion. It's cleaner and easier to understand for any developer.

  • No need, if necessary, to declare variables __block or __weak.
  • If you wanna use the block in a method that has a return value you cannot return it in the block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment