Le mie app hanno funzionalità extra per l'iPhone 5 e ho creato una classe separata con un file .xib. Vorrei rilevare l'altezza dello schermo (a meno che non sia possibile ottenere l'ID/modello del dispositivo) e caricare di conseguenza un controller di visualizzazione diverso. Ho provato questo:Caricamento di un altro xib per l'iPhone 5
- (IBAction)select:(id)sender {
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
if (screenHeight == 960) {
Selection *selectView =[[Selection alloc] initWithNibName:nil bundle:nil];
selectView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:selectView animated:YES];
}
else {
Selection_5 *selectView =[[Selection_5 alloc] initWithNibName:nil bundle:nil];
selectView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:selectView animated:YES];
}
}
Selection e Selection_5 sono due classi diverse, ognuna con un xib diverso per l'interfaccia utente.
Sì, ha funzionato. Ho usato float ScreenHeight = [UIScreen mainScreen] .bounds.size.height –
questo è aiutare a risolvere questo problema http://stackoverflow.com/questions/13275144/how-to-make-xib-compatible- with-iphone-5-and-iphone-4-devices/13283851 # 13283851 –