-1

For some reasons I am unable to set PKInk color to black.

It works with yellow, red, blue, …but black is just ignored and I get the stroke in white when getting image from drawing.

This is really weird and I don’t know why.

I tried by setting black to PKInkingTool and even by creating a stroke manually and set the PKInk color to black.

Do you have an idea?

Thanks.

thierryb
  • 3,660
  • 4
  • 42
  • 58

1 Answers1

0

I found the solution but still don't understand why it was not working.

I have to convert color using PKInkingTool.convertColor from an interface style to light, and then I am able to use dark color.

let blackColor = PKInkingTool.convertColor(.black, from: self.viewController.traitCollection.userInterfaceStyle, to: .light)

let newStroke = PKStroke(ink: PKInk(stroke.ink.inkType, color: blackColor), path: newPath)

thierryb
  • 3,660
  • 4
  • 42
  • 58