How to get device width and height?

后端 未结 12 1115
离开以前
离开以前 2020-12-23 14:13

In Objective-C we can get device width and height by using following code :

CGRect sizeRect = [UIScreen mainScreen].applicationFrame
float width = sizeRect.         


        
12条回答
  •  执笔经年
    2020-12-23 14:56

    I haven't tried but it should be..

    var bounds = UIScreen.main.bounds
    var width = bounds.size.width
    var height = bounds.size.height
    

提交回复
热议问题