1
I'm新斯威夫特3和我正嘗試將功能轉化爲斯威夫特3:CGPathCreateCopyByTransformingPath斯威夫特3
- (void) drawRect: (CGRect)rect
{
if (self.editionMode == Zoom) {
for (Area *area in self.mArrayPaths) {
CGAffineTransform zoom = CGAffineTransformMakeScale(self.scale, self.scale);
CGPathRef movedPath = CGPathCreateCopyByTransformingPath([area.pathArea CGPath], &zoom);
area.pathAreaTransformed = [UIBezierPath bezierPathWithCGPath:movedPath];
[area.fillColor setFill];
[area.strokeColor setStroke];
[area.pathAreaTransformed fill];
[area.pathAreaTransformed stroke];
}
}
else if (self.editionMode == MoveShapes) {
[self.currentArea.fillColor setFill];
[self.currentArea.pathAreaShift fill];
[self.currentArea.pathAreaShift stroke];
for (Area *area in self.mArrayPaths) {
if (area == self.currentArea) {
continue;
}
[area.fillColor setFill];
[area.strokeColor setStroke];
[area.pathArea fill];
[area.pathArea stroke];
}
} else {
[self.currentArea.fillColor setFill];
[self.currentArea.pathArea fill];
[self.currentArea.pathArea stroke];
for (Area *area in self.mArrayPaths) {
[area.fillColor setFill];
[area.strokeColor setStroke];
[area.pathArea fill];
[area.pathArea stroke];
}
}
}
我已經到目前爲止這一點,但我還沒有豆能這部分翻譯:
CGAffineTransform zoom = CGAffineTransformMakeScale(self.scale, self.scale);
CGPathRef movedPath = CGPathCreateCopyByTransImformingPath([area.pathArea CGPath], &zoom);
area.pathAreaTransformed = [UIBezierPath bezierPathWithCGPath:movedPath];
I'm這樣的:
override func draw(_ rect: CGRect) {
if self.editionMode == EditionMode.Zoom {
for area in self.mArrayPaths {
if let area = area as? Area {
var zoom: CGAffineTransform = CGAffineTransform.init(scaleX: self.scale, y: self.scale)
var movedPath = CGPath.copy(using: &zoom)
if let movedPath = movedPath {
area.pathAreaTransformed = UIBezierPath(cgPath: movedPath)
}
}
}
}
}
I'm收到此錯誤:
Ambiguous reference to member 'copy(dashingWithPhase:lengths:transform :) '
我沒有發現任何在網絡上,但這樣的:
但我不能使它發揮作用。
在此先感謝。
快樂編碼。