중간에 명확한 사각형 컷 아웃이있는 blurredView의 오버레이를 만듭니다. 지금까지 내 코드는 반대로, 즉 중앙에 흐림 컷 아웃이있는 clearView를 구현했습니다.명확한 잘라 내기로 blurView 만들기
나는 다음과 같은 게시물에서 나의 발걸음을 적응시켰다. 누군가 올바른 방향으로 나를 가리킬 수 있다면 고맙겠다.
Swift mask of circle layer over UIView
CALayer with transparent hole in it
let blurView = UIVisualEffectView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height))
blurView.effect = UIBlurEffect(style: UIBlurEffectStyle.dark)
let scanLayer = CAShapeLayer()
scanLayer.path = CGPath(rect: scanRect, transform: nil)
view.addSubview(blurView)
blurView.layer.addSublayer(scanLayer)
blurView.layer.mask = scanLayer
처럼 할 수 ...하지만 마지막 줄이 blurView.layer.mask 안 = scanLayer – Naresh
이 사용 https://stackoverflow.com/questions/29647792/swift-how-to-create-a-view-with-a-shape-cropped-in-it Dănuţ Mihai Florian의 답변보기 – Naresh