简体   繁体   中英

CGRect in F# - Undefined

What is the equivalent of CGRect in F# : https://developer.xamarin.com/api/type/CoreGraphics.CGRect/

In C# we do:

new CGRect(50, 0, 200, 100)

but this is undefined in F# ...I also tried CGRectMake which was the old syntax, but that doesn't work either. I made sure that I imported CoreGraphics , and also tried CoreGraphics.CGRect .

Your documentation says CGRect constructors take floating point numbers, so try this - assuming you indeed have all the open statements in place:

CGRect(50.0, 0.0, 200.0, 100.0)

F# doesn't do implicit conversions of numeric types, you need to use the correct literal for the numeric type you want to use.

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