Ios 如何将AsyncDisplayKit的标题设置为ButtonNode?

Ios 如何将AsyncDisplayKit的标题设置为ButtonNode?,ios,swift,asyncdisplaykit,Ios,Swift,Asyncdisplaykit,我可以使用以下命令设置正常状态的标题: let buttonTitle = NSAttributedString(string: "Book", attributes: attributes) buttonNode.titleNode.attributedText = buttonTitle 但是,这不会为按钮的禁用状态设置标题。为此,我尝试添加以下内容: buttonNode.setAttributedTitle(buttonTitle, for: .disabled) 但是,这会删除正常

我可以使用以下命令设置正常状态的标题:

let buttonTitle = NSAttributedString(string: "Book", attributes: attributes)
buttonNode.titleNode.attributedText = buttonTitle
但是,这不会为按钮的禁用状态设置标题。为此,我尝试添加以下内容:

buttonNode.setAttributedTitle(buttonTitle, for: .disabled)
但是,这会删除正常状态下的磁贴。没有
控件状态。正常


如何将按钮标题设置为在所有状态下都相同?

可以通过为ASControlState设置空数组来为所有状态设置按钮标题:

let buttonTitle = NSAttributedString(string: "Book", attributes: attributes)
buttonNode.setAttributedTitle(buttonTitle, for: [])
fileprivate var noteButtonNode : ASButtonNode = ASButtonNode()

let attributedTitle : NSAttributedString = NSAttributedString(
            string: "Book",
            attributes: [
                NSFontAttributeName: UIFont.init(name: Fonts.Your_font, size: 16)!,
                NSForegroundColorAttributeName: Colors.Your_Color
            ])
        noteButtonNode.setAttributedTitle(attributedTitle, for: ASControlState())