Diamond-like UIView
问题 I am trying to create a UIView with corners like a shape of a diamond, as shown in the picture: I am familiar with rounding off corners: myView.layer.cornerRadius = 10 However, I want a different shape. How could I create this effect? Thanks for your help! 回答1: Best way to solve a problem like this is by using CAShapeLayer. Here's the kind of thing that would work: paste it into a playground and see how it clips off the corners. import UIKit import XCPlayground extension UIView { func