UIScreen *currentScreen = [UIScreen mainScreen]; NSLog(@"applicationFrame.size.height = %f",currentScreen.applicationFrame.size.height); NSLog(@"applicationFrame.size.width = %f",currentScreen.applicationFrame.size.width); NSLog(@"applicationFrame.origin.x = %f",currentScreen.applicationFrame.origin.x); NSLog(@"applicationFrame.origin.y = %f",currentScreen.applicationFrame.origin.y); NSLog(@"bounds.x = %f",currentScreen.bounds.origin.x); NSLog(@"bounds.y = %f",currentScreen.bounds.origin.y); NSLog(@"bounds.height = %f",currentScreen.bounds.size.height); NSLog(@"bounds.width = %f",currentScreen.bounds.size.width); NSLog(@"brightness = %f",currentScreen.brightness);
更新:
iOS 9 之后:使用 [UIScreen mainScreen].bounds代替 [UIScreen mainScreen].applicationFrame