我正在将 IQKeyboardManager 与 Swift 一起使用。我在日期选择器上添加了一个取消按钮。一切正常,但我遇到了取消按钮的属性文本没有生效的问题。我究竟做错了什么?这是一个代码片段
cell.field.attributedPlaceholder = NSAttributedString(string: "Cancel",
attributes: [.foregroundColor: UIColor.black,
.font: UIFont.boldSystemFont(ofSize: 12)])
cell.field.keyboardToolbar.titleBarButton.setTarget(self,
action:#selector(datePickerWasCanceled(sender:)))
这是当前结果的示例屏幕截图——我原以为取消应该是黑色和粗体。