简体   繁体   English

F#中的CGRect-未定义

[英]CGRect in F# - Undefined

What is the equivalent of CGRect in F# : https://developer.xamarin.com/api/type/CoreGraphics.CGRect/ F#CGRect的等效项是什么: https : //developer.xamarin.com/api/type/CoreGraphics.CGRect/

In C# we do: 在C#中,我们这样做:

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. 但这在F#是未定义的...我也尝试了CGRectMake ,这是旧的语法,但这也不起作用。 I made sure that I imported CoreGraphics , and also tried CoreGraphics.CGRect . 我确保导入了CoreGraphics ,并尝试了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构造函数采用浮点数,因此请尝试执行此操作-假设您确实具有所有open语句:

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. F#不会对数字类型进行隐式转换,您需要为要使用的数字类型使用正确的文字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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