300x250 UIBezierPath2 UIBezierPath 도형을 직접 만들어야 한다면 베지어 곡선 (BezierPath)를 이용할 수 있다. 베지에 곡선이란 n개의 점으로 만들어지는 직선 및 곡선을 말한다. 이 곡선을 이용하면 원하는 형태의 도형을 쉽게 그려낼 수 있다. 애플에서 제공되는 UIBezierPath를 이용한다. 가운데 뚫린 뷰 import UIKit class MakePath: UIView { override func draw(_ rect: CGRect) { let path = UIBezierPath() path.lineWidth = 1 path.lineJoinStyle = .bevel path.usesEvenOddFillRule = true path.move(to: CGPoint(x: 0, y: 0)) path.addLine(to: CGPoint.. 2022. 11. 8. cornerRadius 원하는 부분에만 적용 UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.myview.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(25.0f, 25.0f)]; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.myview.bounds; maskLayer.path = maskPath.CGPath; self.myview.layer.mask = maskLayer; 2021. 12. 15. 이전 1 다음 300x250