The methods are slightly different. [UIScreen mainScreen]
returns the devices UIScreen
object, the bounds of this will always be the size of the devices screen. [UIApplication sharedApplication].keyWindow
returns the current key UIWindow
for the application, which could conceivably not be the full size of the devices screen.
Another obvious case where these could differ is if the device is attached to multiple screens. In this case, [UIScreen mainScreen].bounds
will always return the devices screen size, but the key window could be on one of the other screens, and it will have a completely different size, depending on what kind of screen it is attached to.