what is the code to detect whether ios app running in iPhone, iPhone Retina display, or iPad?

前端 未结 5 1656
走了就别回头了
走了就别回头了 2021-01-02 06:03

what is the code to detect whether ios app running in iPhone, iPhone Retina display, or iPad?

Background:

  • for my iPhone application I have defined i

5条回答
  •  醉酒成梦
    2021-01-02 06:28

    For Swift Solution:

     if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad)     
     {
            // Ipad
     }
     else 
     {
           // Iphone
     }
    

提交回复
热议问题