To obtain the screen size based on the orientation and type of device, use this:
CGRect screenFrame = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenFrame.size.width; CGFloat screenHeight = screenFrame.size.height;
screenWidth
will return the width, and screenHeight
, the height of your screen, even when your device is in the landscape orientation.