答案 0 :(得分:1)
我将代码从this转换为Swift:
import UIKit
public extension UIAccessibility {
public static var isButtonShapesEnabled: Bool {
let button = UIButton()
button.setTitle("Button Shapes", for: .normal)
return button.titleLabel?.attributedText?.attribute(NSAttributedString.Key.underlineStyle, at: 0, effectiveRange: nil) != nil
}
}
用法:
if UIAccessibility.isButtonShapesEnabled {
// Apply button shapes style to custom button...
}