0

I want to get a buttonNode as same as UIButton(type: .system). how to set it

shingo.nakanishi
  • 2,045
  • 2
  • 21
  • 55
Mr.Laity
  • 133
  • 1
  • 8

1 Answers1

2
    let buttonNode = ASDisplayNode { () -> UIButton in
        let button = UIButton(type: .system)
        button.backgroundColor = UIColor.white
        button.cornerRadius = 4
        button.setTitleColor(UIColor.red, for: .normal)
        button.titleLabel?.font = UIFont.systemFont(ofSize: 17)
        return button
    }

    if let button = buttonNode.view as? UIButton {
        button.setTitle("qqq", for: .normal)
        button.addTarget(self, action: #selector(tapAction), for: .touchUpInside)
    }
Mr.Laity
  • 133
  • 1
  • 8