Easy way for Checking Device Type


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //Place this in the .m file outside any function.
  2.  
  3. BOOL isiPhone(){
  4. return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
  5. }
  6. BOOL isiPad(){
  7. return (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone);
  8. }
  9.  
  10.  
  11. //Then call it from any function like this:
  12. if (isiPhone()) {
  13. //This device is an iphone
  14. }
  15.  
  16. if (isiPad()) {
  17. //This device is an iPad
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.