Browse Source

Actionsheet: Set rounded corners

Mike JS. Choi 6 years ago
parent
commit
99d76f24cf
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Sources/VLCActionSheet/VLCActionSheet.swift

+ 6 - 0
Sources/VLCActionSheet/VLCActionSheet.swift

@@ -202,6 +202,12 @@ class VLCActionSheet: UIViewController {
         // This is to avoid a horrible visual glitch!
         mainStackView.isHidden = false
 
+        let roundedCornerPath = UIBezierPath(roundedRect: headerView.bounds, byRoundingCorners: [.topLeft, .topRight],
+                                             cornerRadii: CGSize(width: 10, height: 10))
+        let maskLayer = CAShapeLayer()
+        maskLayer.path = roundedCornerPath.cgPath
+        headerView.layer.mask = maskLayer
+
         UIView.transition(with: backgroundView, duration: 0.2, options: .transitionCrossDissolve, animations: { [weak self] in
             self?.backgroundView.isHidden = false
             }, completion: nil)