What is a CGFloat?

原文:https://www.hackingwithswift.com/example-code/language/what-is-a-cgfloat

CGFloat is a specialized form of Float that holds either 32-bits of data or 64-bits of data depending on the platform. The CG tells you it's part of Core Graphics, and it's found throughout UIKit, Core Graphics, Sprite Kit and many other iOS libraries.

CGFloat是一种特殊形式的Float,根据平台的不同,它可以保存32位数据或64位数据。CG告诉你它是核心图形的一部分,它可以在UIKit、核心图形、Sprite Kit和许多其他iOS库中找到。

If you have a Float or Double and need a CGFloat, you can convert it like this:

let myCGFloat = CGFloat(myDouble)

  

原文地址:https://www.cnblogs.com/huaan011/p/12353306.html