如何创建像下面图像一样的倾斜视图。
请给我一个解决方案。我尝试了很多方法,但没有找到合适的解决方案。
private let kTableHeaderHeight: CGFloat = 400.0
private let kTableHeaderCutAway: CGFloat = 60.0
var headerRect = CGRect(x: 0, y: -effectiveHeight, width: self.view.bounds.width, height: kTableHeaderHeight)
headerRect.size.height = kTableHeaderCutAway/2
headerView1.frame = headerRect
let path = UIBezierPath() path.move(to: CGPoint(x: 0, y: 0))
path.addLine(to: CGPoint(x: headerRect.width, y: 0))
path.addLine(to: CGPoint(x: headerRect.width, y: headerRect.height))
path.addLine(to: CGPoint(x: 0, y: headerRect.height-kTableHeaderCutAway))
headerMaskLayer?.path = path.cgPath headerView1.layer.mask = headerMaskLayer [1]: