为什么这个按钮约束设计不起作用?
why isn't this button Constraints Design working?
请问我是新手 iOS 开发人员。我正在处理一个应用程序。我刚刚创建了 ios 屏幕,但这不符合设计级别,我需要重新配置它。在这里,我也附上截图。请找到这些屏幕并指导我
P.s。我正在使用堆栈视图来创建应用程序的屏幕
这里我使用了一个 Vertical Stackview 和 4 个 horizontal stack view
此代码会有所帮助:
extension UIButton {
func roundCorners(_ corners:UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
}
//Call this Extension like this:
btn.roundCorners([.topLeft, .bottomRight], radius: 20.0)
请问我是新手 iOS 开发人员。我正在处理一个应用程序。我刚刚创建了 ios 屏幕,但这不符合设计级别,我需要重新配置它。在这里,我也附上截图。请找到这些屏幕并指导我 P.s。我正在使用堆栈视图来创建应用程序的屏幕
这里我使用了一个 Vertical Stackview 和 4 个 horizontal stack view
此代码会有所帮助:
extension UIButton {
func roundCorners(_ corners:UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
}
//Call this Extension like this:
btn.roundCorners([.topLeft, .bottomRight], radius: 20.0)