C#中的CGRect - 未定义

问题描述 投票:2回答:1

什么是CGRect中的F#https://developer.xamarin.com/api/type/CoreGraphics.CGRect/

在C#中我们做:

new CGRect(50, 0, 200, 100)

但这在F#中未定义...我也尝试过CGRectMake这是旧的语法,但这也不起作用。我确保我导入了CoreGraphics,并尝试了CoreGraphics.CGRect

c# ios xamarin f# cgrect
1个回答
3
投票

你的文档说CGRect构造函数采用浮点数,所以试试这个 - 假设你确实有所有的open语句:

CGRect(50.0, 0.0, 200.0, 100.0)

F#不进行数值类型的隐式转换,您需要为要使用的数字类型使用正确的文字。

© www.soinside.com 2019 - 2024. All rights reserved.