-1
A
回答
1
int width = self.view.frame.size.width
int height = self.view.frame.size.height
所以,當你得到的框架,你可以得到的寬度和高度。
+0
但是,對於「頁面」,是不是「框架」整個「框架」? –
+0
@LasseMadsen,因爲你已經被告知,沒有。屏幕上的每個元素都是'UIView'的子類。每個viewController都有一個覆蓋整個屏幕的「UIView」。然後,在這之上添加'UIView'的子類。每個人都有自己的屬性,名爲'frame' –
+0
你能給我一張照片嗎?顯示你的問題? –
0
如果你想獲得視圖的大小:如果您想獲得整個頁面的大小
float viewWidth = view.Frame.Width;
float viewHeight = view.Frame.Height;
:
float screenWidth = UIScreen.MainScreen.Bounds.Width;
float screenHeight = UIScreen.MainScreen.Bounds.Height;
希望它可以幫助你。
獲取框架並從框架中獲取大小。 –
但是'Frame'並不是整個'Page'? –
每個視圖都有自己的框架 –