Specify images for iPad in Xcode like @2x for iPhone 4

前端 未结 2 445
走了就别回头了
走了就别回头了 2020-12-15 23:18

I have upgraded my current target to iPad and made a universal app and the time for adjusting my iphone app to ipad would decrease significantly if there is an answer for th

2条回答
  •  太阳男子
    2020-12-15 23:45

    I don't think there's a way to get the OS to pick it automatically for you, like there is for the Retina display. But, you could create a convenience method to return your filenames for you like:

    -(NSString*) myImageFilename:(NSString*)baseName withExtension:(NSString*)ext {
    
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
      return [NSString stringWithFormat:"%@@iPadSize.%@"];
     } else {
      return [NSString stringWithFormat:"%@.%@"];
     } 
    
    }
    

提交回复
热议问题