The UIDevice class can help us do that like so:
[super viewDidLoad]; // lets detect the height of our screen here int height = [UIScreen mainScreen].bounds.size.height; int width = [UIScreen mainScreen].bounds.size.width; // share the news NSString *message = [[NSString alloc]initWithFormat:@"This screen is \n\n%i pixels high and\n%i pixels wide", height, width]; NSLog(@"%@", message);
This will work fine in your View Controllers and App Delegate files.
I’ve got a full working demo project on GitHub: https://github.com/versluis/ScreenSize
Further Reading: