vendredi 8 juillet 2016

SKShapeNode(path: path) does not draw


Here i am attempting to draw gridLines for a grid whose border I have successfully created as a SKShapeNode however I am unable to get the lines to be visible when running this code. func drawGridLines() { print("drawing") for row in 0...40 { let path = CGPathCreateMutable() CGPathMoveToPoint(path, nil, grid.frame.origin .x , grid.frame.origin.y + CGFloat(row * 10)) CGPathAddLineToPoint(path, nil, grid.frame.width, grid.frame.origin.y + CGFloat(row * 10)) let shape = SKShapeNode(path: path) shape.path = path shape.position = CGPoint(x: CGRectGetMidX(frame), y: CGRectGetMidY(frame)) shape.fillColor = UIColor.redColor() shape.strokeColor = UIColor.blueColor() shape.lineWidth = 10 addChild(shape) for col in 0...90 { print("y") } } }

Aucun commentaire:

Enregistrer un commentaire