
UIDrawBrushGradient::delStop 메서드는 Gradient Brush의 Stop을 삭제하는 메서드입니다.
이 메서드는 Index를 매개변수로 받습니다. Index는 Stop의 인덱스를 나타냅니다.
예를 들어, Gradient Brush에 3개의 Stop이 있다면, Index 0, 1, 2를 삭제할 수 있습니다.
delStop 메서드는 Stop을 삭제하는 것이므로, 삭제하고자 하는 Stop의 Index를 매개변수로 전달하면 됩니다.
#hostingforum.kr
swift
let gradient = CGGradient(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: [UIColor.red.cgColor, UIColor.blue.cgColor, UIColor.green.cgColor] as CFArray, locations: [0.0, 0.5, 1.0] as CFArray)
let brush = CGGradientDrawingOptions(rawValue: UInt32(0))
// Stop 삭제
brush.delStop(at: 1)
위의 예제에서 Stop 1을 삭제합니다.
Note: delStop 메서드는 Stop의 Index를 삭제합니다. Index 0은 첫 번째 Stop, Index 1은 두 번째 Stop, Index 2는 세 번째 Stop을 나타냅니다.
또한, delStop 메서드는 Gradient Brush의 색상을 변경하는 것이므로, 변경하고자 하는 색상을 삭제한 후, 다시 Gradient Brush를 생성해야 합니다.
#hostingforum.kr
swift
// Gradient Brush 재생성
let gradient = CGGradient(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: [UIColor.red.cgColor, UIColor.green.cgColor] as CFArray, locations: [0.0, 1.0] as CFArray)
let brush = CGGradientDrawingOptions(rawValue: UInt32(0))
2025-03-20 19:35