2012-09-27 17 views
5

Ho un'app iOs con sfondo a tutto schermo a gradiente. Ora, con iPhone 5 le dimensioni dello schermo sono diverse e ovviamente mi piacerebbe supportare sia il quinto che il quarto dispositivo.iOS 6 background image

Qual è il modo consigliato per farlo?

risposta

1

Dal post che ho linkato al commento

#import <sys/utsname.h> 

NSString* 
machineName() 
{ 
struct utsname systemInfo; 
uname(&systemInfo); 

return [NSString stringWithCString:systemInfo.machine 
          encoding:NSUTF8StringEncoding]; 
} 

il risultato dovrebbe essere:

@"i386"  on the simulator 
@"iPod1,1" on iPod Touch 
@"iPod2,1" on iPod Touch Second Generation 
@"iPod3,1" on iPod Touch Third Generation 
@"iPod4,1" on iPod Touch Fourth Generation 
@"iPhone1,1" on iPhone 
@"iPhone1,2" on iPhone 3G 
@"iPhone2,1" on iPhone 3GS 
@"iPad1,1" on iPad 
@"iPad2,1" on iPad 2 
@"iPhone3,1" on iPhone 4 
@"iPhone4,1" on iPhone 4S 

sto assumendo questo restituirà qualcosa come @ "iPhone5,1" per le ultime modello. Poi basta fare un controllo come

NSString *iphoneType = machineName(); 
if ([iphoneType [email protected]"iPhone5,1"]){ 
    //image for iphone 5 
} else { 
      //image for the rest 
} 

Fatemi sapere se funziona fuori

+1

modo programma è chiaro. Che ci sia qualcosa "Approvato da Apple"? Come avere immagini con il nome @xxx, ecc. –

+0

Stai dicendo che lo sfondo intero è un'immagine? – TheJer

+0

supponiamo che sia :) –