My apps has extra functionality for the iPhone 5, and I've created a separate class with an .xib for it. I would like to detect the screen height (unless it's possible to get the device ID/model) and load a different view controller accordingly. I have tried this:
- (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 and Selection_5 are two different classes, each with a different xib for the user interface.