gpt4 book ai didi

ios - 根据 View 设置按钮一侧的角半径?

转载 作者:行者123 更新时间:2023-11-30 10:57:42 24 4
gpt4 key购买 nike

我必须根据背景中找到的 UIView 设置角半径。我附上了我的开发图片供您引用。

this is what I got after developement

最佳答案

你可以这样尝试。

  if #available(iOS 11.0, *) {
customView.layer.cornerRadius = 10
customView.layer.maskedCorners = [.layerMinXMaxYCorner,.layerMinXMinYCorner,.layerMaxXMinYCorner]
} else {
// Fallback on earlier versions

let rectShape = CAShapeLayer()
rectShape.bounds = customView.frame
rectShape.position = customView.center
rectShape.path = UIBezierPath(roundedRect: customView.bounds, byRoundingCorners: [.bottomRight , .topLeft , .topRight], cornerRadii: CGSize(width: 10, height: 10)).cgPath
customView.layer.mask = rectShape
}

关于ios - 根据 View 设置按钮一侧的角半径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53758364/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com