我有一个内部带有imageButton的UIBarButtonItem,但是图像的渲染效果不好,因此我在其上应用了CATransform3DMakeScale,但该UIBarButtonItem不再起作用,您无法单击 >。
这是UIBarButtonItem的代码:
let importButton = UIButton(frame: CGRect(x: 0, y: 0, width: 22, height: 22))
// Image
importButton.setBackgroundImage(UIImage(named: "ic_action_import_base"), for: .normal)
// The critical transform
importButton.layer.transform = CATransform3DMakeScale(1.8, 1.8, 0)
// Action
importButton.addTarget(self, action: #selector(importButtonTriggered), for: .touchUpInside)
let importUIBarButton = UIBarButtonItem(customView: importButton)
// Constraints for the size
let importCurrWidth = importUIBarButton.customView?.widthAnchor.constraint(equalToConstant: 22)
importCurrWidth?.isActive = true
let importCurrHeight = importUIBarButton.customView?.heightAnchor.constraint(equalToConstant: 22)
importCurrHeight?.isActive = true
是否有人想拥有并且具有可点击的UIBarButtonItem的良好呈现效果?