Post

Replies

Boosts

Views

Activity

Reply to ios 26, CAShapeLayer with pattern image not work
The pattern fill colors of rectangles and circles (including ellipses) cannot be displayed properly, but as long as the shape is not a rectangle or a circle, the fill color can be displayed normally. Writing in the following way can temporarily fix this issue: path.removeAllPoints() path.move(to: rect.standardized.origin) path.addLine(to: CGPoint(x: rect.maxX, y: rect.minY)) path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY)) // TODO: The purpose of -0.001 is to prevent the path from becoming a rectangle. if #available(iOS 26.0, *) { path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY - 0.001)) } else { path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY)) } path.close() layer.path = path.cgPath
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’25