2016-10-12 5 views
0

Können Sie mir bitte helfen, dieses Problem zu lösen, da ich keine Idee bekomme, um es zu lösen.cgcontextaddcurvetopoint ist in swift nicht verfügbar 3

for (x,height) in variances.enumerated() 
    { 
     let p = CGPoint(x: step + waveWidth*CGFloat(x), y: self.frame.size.height/2) 
     let cp1 = CGPoint(x: p.x - (3.0/4.0)*waveWidth ,y: p.y + (waveHeight + CGFloat(variance/2) - height)) 
     let cp2 = CGPoint(x: p.x - (1.0/4.0)*waveWidth, y: p.y - (waveHeight + CGFloat(variance/2) - height)) 

     CGContextAddCurveToPoint(context, cp1.x, cp1.y, cp2.x, cp2.y, p.x, p.y) 

    } 

Antwort

1

lesen swift-evolution und Xcode 8 Release Notes.

Zusammenfassung: In Swift 3 werden C-Funktionsdeklarationen von Frameworks wie CoreGraphics nicht als CGContextDoSomething: CGContext -> T -> U, sondern als Member-Methoden vom Typ CGContext importiert. So muss es so genannt werden:

let context: CGContext = <…> // Get CGContext instance, how is irrelevant for example 
context.doSomething(<…>) 

Auch sollten Sie versuchen, CGPath mit Kurve statt direkt im Kontext zu zeichnen.

Verwandte Themen