作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经尝试将代码从 playground 复制到 iOS 开发环境,它显示错误 ="Expressions are not allowed at the top level"
我已经将这段代码从 playgrounds 复制到 iOS viewController 和 AppDelegate
var ovalPath = UIBezierPath(ovalInRect: CGRectMake(59, 28, 123, 50))
UIColor.grayColor().setFill()
椭圆路径.fill()
我用这段代码画了一个椭圆。
最佳答案
我很确定您可能已将该代码放在任何函数代码空间之外。
确保您发布的代码在类似这样的函数中:
class SomeClass {
func someFunc() {
// that code goes here
}
}
关于swift - 我如何将在 playgrounds 中编写的顶级代码转换为 iOS 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29701545/
我是一名优秀的程序员,十分优秀!