2011-03-25 105 views

回答

44

要获得设备的屏幕尺寸,请致电UIScreen.MainScreen.Bounds。它返回一个RectangleF的屏幕尺寸。

7

为了得到宽使用,

UIScreen.MainScreen.Bounds.Width 

要得到高度利用,

UIScreen.MainScreen.Bounds.Height 
0

您使用UIScreen.MainScreen.Bounds得到尺寸的画面。 它返回屏幕的点值,而不是像素大小。

UIScreen.MainScreen.Scale对于非视网膜显示器,每点返回1.0像素,视网膜显示器每点返回2.0像素。

UIScreen.MainScreen.Bounds.Size.Width * UIScreen.MainScreen.Scale将获得以像素为单位的宽度。