I was looking at the UIWindow
class reference and there I found the UIScreen
property which defaults to [UIScreen mainScreen]
@property(nonatomic,retain) UIScreen *screen NS_AVAILABLE_IOS(3_2);
// default is [UIScreen mainScreen]. changing the screen may be an expensive operation and should not be done in performance-sensitive code
We initiailise the UIWindow
object with the UIScreen
in AppDelegate
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]
I am wondering why do we need the UIScreen
property in UIWindow
UIScreen refers to the device frame.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScreen_Class/index.html
You can get the device size for finding the Devices iPhone 4,iPhone 5, iPhone 6, iPhone 6+ & iPad
[[UIScreen mainScreen] bounds]
//gives u the size of the device.You can differentiate the devices as per above sizes.
[[UIScreen mainScreen] bounds].size.width
//gives the width of device[[UIScreen mainScreen] bounds].size.height)
//gives the height of device.Or you can use in this way
Hope it helps you...