1. CGPathMoveToPoint' 不可用:使用 move(to:transform:) 2. 'CGPathAddLineToPoint' 不可用:使用 addLine(to:transform:) [英] 1. CGPathMoveToPoint' is unavailable: Use move(to:transform:) 2. 'CGPathAddLineToPoint' is unavailable: Use addLine(to:transform:)

查看:36
本文介绍了1. CGPathMoveToPoint' 不可用:使用 move(to:transform:) 2. 'CGPathAddLineToPoint' 不可用:使用 addLine(to:transform:)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Xcode 7.3.1 中的 swift 2 中创建了我的应用程序之一.但是现在我在 Xcode 8.0 中打开了相同的应用程序并执行更改.完成了一些自动更改,并显示了一些错误和建议,我已更正它们.但我面临的问题是

let path = CGMutablePath()CGPathMoveToPoint(path, nil, lineFrame.midX, lineFrame.midY)CGPathAddLineToPoint(path, nil, lineFrame.origin.x + lineFrame.width/2, lineFrame.origin.y)

我尝试创建path,但显示错误

<块引用>

  1. CGPathMoveToPoint 不可用:使用 move(to:transform:)
  2. CGPathAddLineToPoint 不可用:使用 addLine(to:transform:)

如果有人有解决方案,请告诉我.

解决方案

试试这个:

 let path = CGMutablePath()path.move(to: CGPoint(x: lineFrame.midX, y: lineFrame.midY))path.addLine(to: CGPoint(x: lineFrame.origin.x + lineFrame.width/2, y: lineFrame.origin.y))

并查看CGMutablePath的最新参考:

CGMutablePath

I have created one of my application in swift 2 in Xcode 7.3.1. But now I have open same application in Xcode 8.0 and perform changes. Some automatic changes are done and some errors and suggestions shown I have corrected them. But I am facing issue that

let path = CGMutablePath()
CGPathMoveToPoint(path, nil, lineFrame.midX, lineFrame.midY)
CGPathAddLineToPoint(path, nil, lineFrame.origin.x + lineFrame.width / 2, lineFrame.origin.y)

I tried to create path, but shows error that

  1. CGPathMoveToPoint is unavailable: Use move(to:transform:)
  2. CGPathAddLineToPoint is unavailable: Use addLine(to:transform:)

If anyone have solution, please let me know.

解决方案

Try this:

    let path = CGMutablePath()
    path.move(to: CGPoint(x: lineFrame.midX, y: lineFrame.midY))
    path.addLine(to: CGPoint(x: lineFrame.origin.x + lineFrame.width / 2, y: lineFrame.origin.y))

And check the latest reference of CGMutablePath:

CGMutablePath

这篇关于1. CGPathMoveToPoint' 不可用:使用 move(to:transform:) 2. 'CGPathAddLineToPoint' 不可用:使用 addLine(to:transform:)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆