我正在尝试为我的Xamarin.iOS应用翻译此代码:
https://github.com/yourtion/YXWaveView/blob/master/YXWaveView/YXWaveView.swift
第179行:
let path = CGMutablePath()
我在Xamarin中找不到CGMutablePath
?
答案 0 :(得分:2)
ObjC CGMutablePathRef
struct(或Swift CGMutablePath类)被Xamarin.iOS
包装为CGPath
(CoreGraphics
命名空间)。
var path = new CGPath();
public class CGPath : INativeObject, IDisposable {
internal IntPtr handle;
[DllImport (Constants.CoreGraphicsLibrary)]
extern static /* CGMutablePathRef */ IntPtr CGPathCreateMutable ();
public CGPath ()
{
handle = CGPathCreateMutable ();
}
[Mac(10,7)][iOS (5,0)]
public CGPath (CGPath reference, CGAffineTransform transform)
{
if (reference == null)
throw new ArgumentNullException ("reference");
handle = CGPathCreateMutableCopyByTransformingPath (reference.Handle, ref transform);
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static /* CGMutablePathRef */ IntPtr CGPathCreateMutableCopy (/* CGPathRef */ IntPtr path);
public CGPath (CGPath basePath)
{
if (basePath == null)
throw new ArgumentNullException ("basePath");
handle = CGPathCreateMutableCopy (basePath.handle);
}
~~~~~
答案 1 :(得分:1)
您可以使用:
var path = new CGPath();