ios - AsyncDisplayKit ASButtonNode 如何设置 buttonType

标签 ios swift asyncdisplaykit

我想获得一个与 UIButton(类型:.system)相同的按钮节点。 如何设置

最佳答案

    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)
    }

关于ios - AsyncDisplayKit ASButtonNode 如何设置 buttonType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44961708/

相关文章:

ios - Swift 中的 ASCollectionView 和 ASCellNode

iphone - 用户点击 UILocalNotification : Can it pass data to the app?

iphone - odatagen : Failed to generate proxy classes. 请验证元数据(iOS)

ios - 将 SCNNode 固定到位,无需 ARPlaneAnchor

swift - 通知字典中的参数 Any 还是 Bool?

ios - 重新创建 Instagram/Pinterest 个人资料 - 如何在 swift 中重新创建 instagram/pinterest 个人资料?

iphone - iOS开发: Does automatch always timeout around five minutes of waiting?

html - 从 iOS 中的下载字符串中提取 URL

swift - 从 swift 3 迁移到 swift 4 - 无法将 String 转换为预期的 String.Element

ios - ASTableNode setSelected 更改 ios 中 ASDisplayNode 的背景颜色