0

I have two images, and I want to have the left one clipped so it looks like they are placed with a diagonal line in between. Like so:

enter image description here

I'm able to create the path and clip, but cannot figure out how to set the line width for just the right part...

My code:

let path = UIBezierPath()
        path.moveToPoint(CGPoint(x: 0, y: 0))
        path.addLineToPoint(CGPoint(x: leftContentView.frame.width, y: 0))
        path.addLineToPoint(CGPoint(x: leftContentView.frame.width - 20, y: leftContentView.frame.height))
        path.addLineToPoint(CGPoint(x: 0, y: leftContentView.frame.height))
        path.closePath()
        let mask = CAShapeLayer()
        mask.path = path.CGPath
        self.leftContentView.layer.mask = mask
JDM
  • 883
  • 1
  • 8
  • 20

1 Answers1

0

Just use no line and add an additional layer representing the line with the appropriate implied width.

Mundi
  • 79,884
  • 17
  • 117
  • 140