2017-01-16 4 views
0

私はこれで正常な状態のタイトルを設定することができます。しかし、これはボタンの無効な状態のためにタイトルを設定しないAsyncDisplayKit ASButtonNodeでタイトルを設定するにはどうすればよいですか?

let buttonTitle = NSAttributedString(string: "Book", attributes: attributes) 
buttonNode.titleNode.attributedText = buttonTitle 

。これを達成するために、私は次のものを追加しようとしました:

buttonNode.setAttributedTitle(buttonTitle, for: .disabled) 

これは、通常の状態のタイルを削除します。 ASControlState.normalはありません。

どのようにボタンのタイトルをすべての状態で同じにすることができますか?

答えて

0

ボタンのタイトルはASControlStateのための空の配列を設定することにより、すべての状態に設定することができます。

let buttonTitle = NSAttributedString(string: "Book", attributes: attributes) 
buttonNode.setAttributedTitle(buttonTitle, for: []) 
0
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()) 
関連する問題