Get the screen width and height in iOS

Solution:

You can get the screen width and height using the below code...You can access it anyware..

Objective C:


        CGRect viewRect = [[UIScreen mainScreen] bounds];
        CGFloat viewWidth = viewRect.size.width;
        CGFloat viewHeight = viewRect.size.height;


Swift:

        let viewRect = UIScreen.main.bounds

        let viewWidth = viewRect.size.width
        let viewHeight = viewRect.size.height

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift