简体   繁体   中英

Get size of UIView

I have a UIView and some Buttons on a Xamarin Page , and I need to find the Width and Height of the UIView not the Frame .

Are there any ways to solve this?

int width = self.view.frame.size.width
int height = self.view.frame.size.height

So when you get the frame you can get the width and the height.

If you want to get the view's size:

float viewWidth = view.Frame.Width;
float viewHeight = view.Frame.Height;

If you want to get the whole page's size:

float screenWidth = UIScreen.MainScreen.Bounds.Width;
float screenHeight = UIScreen.MainScreen.Bounds.Height;

Hope it can help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM