UISreen类代表了屏幕,开发中一般用来获取屏幕相关的属性,例如获取屏幕的大小。
1
2
3
4
5
6
7
|
//获取屏幕大小
var
screenBounds:
CGRect
=
UIScreen
.mainScreen().bounds
println
(screenBounds)
//iPhone6输出:(0.0,0.0,375.0,667.0)
//获取屏幕大小(不包括状态栏高度)
var
viewBounds:
CGRect
=
UIScreen
.mainScreen().applicationFrame
println
(viewBounds)
//iPhone6输出:(0.0,20.0,375.0,647.0)
|