我想知道如何将以下 objective-c方法转换为 Swift函数? CGPatternRef pattern = CGPatternCreate(NULL, rect, CGAffineTransformIdentity, 24, 24, kCGPatternTilingConstantSpacing, true, callbacks); 我的代码: let callbacks : C
CGPatternRef pattern = CGPatternCreate(NULL, rect, CGAffineTransformIdentity, 24, 24, kCGPatternTilingConstantSpacing, true, &callbacks);
我的代码:
let callbacks : CGPatternCallbacks = CGPatternCallbacks(version: 0) let pattern : CGPatternRef = CGPatternCreate(nil, rect, CGAffineTransformIdentity, 24, 24, kCGPatternTilingConstantSpacing, true, callbacks)
但是我收到了一条错误消息:
‘CGPatternCallbacks’ is not convertible to ‘CConstPointer’
有没有示例代码?谢谢
这样的事情var callbacks : CGPatternCallbacks = CGPatternCallbacks(version: 0) var pattern = CGPatternCreate(nil, rect, CGAffineTransformIdentity, 24, 24, kCGPatternTilingConstantSpacing, true, &callbacks)