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

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift