xcode 带有特定代码的 Swift 3 中的 GCRectMake 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38718109/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:06:22  来源:igfitidea点击:

GCRectMake error in Swift 3 with specific code

swiftxcodesyntaxswift3

提问by user6155249

A quite general question. What exact syntax should I use instead of CGRectMakewhile coding in Swift 3?

一个很笼统的问题。CGRectMake在 Swift 3 中编码时,我应该使用什么确切的语法而不是?

Here is the code I would like to convert from swift 2 - 3:

这是我想从 swift 2 - 3 转换的代码:

{let size = text.boundingRectWithSize(CGSizeMake(view.frame.width - 26, 2000), options: NSStringDrawingOptions.UsesFontLeading.union(.UsesLineFragmentOrigin), context: nil).size}

Thanks for the help!

谢谢您的帮助!

回答by Alupotha

in Swift 3.0 this can be use

在 Swift 3.0 这可以使用

let rect = CGRect(x: 0, y: 0, width: 50, height: 50)

https://www.raywenderlich.com/135655/whats-new-swift-3

https://www.raywenderlich.com/135655/whats-new-swift-3