我可以这样设置正常状态的标题:
let buttonTitle = NSAttributedString(string: "Book", attributes: attributes)
buttonNode.titleNode.attributedText = buttonTitle
但是,这不会设置按钮禁用状态的标题。为了实现这一点,我尝试添加以下内容:
buttonNode.setAttributedTitle(buttonTitle, for: .disabled)
但是,这会删除正常状态的图 block 。没有 ASControlState.normal
。
如何将按钮的标题设置为在所有状态下都相同?
最佳答案
可以通过为 ASControlState 设置空数组来为所有状态设置按钮标题:
let buttonTitle = NSAttributedString(string: "Book", attributes: attributes)
buttonNode.setAttributedTitle(buttonTitle, for: [])
关于ios - 如何在 AsyncDisplayKit ASButtonNode 上设置标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41682384/