gpt4 book ai didi

ios - 向 UIBarButtonItem 添加图像和标签

转载 作者:搜寻专家 更新时间:2023-11-01 07:05:48 25 4
gpt4 key购买 nike

<分区>

如何在 leftBarButtonItem 的导航中添加图像和标签?

enter image description here

我已经为我的导航项分配了一个图像,如下所示:

let notifButton  = UIButton(frame: CGRect(x: 0.0, y: 0.0, width: 40.0, height: 40.0) )

notifButton.setImage(UIImage(named: "notifications_white"), for: UIControlState.normal)
notifButton.addTarget(self, action: #selector(self.notifButtonCLicked), for: UIControlEvents.touchUpInside)

let leftBarButtonItem = UIBarButtonItem(customView: notifButton)
self.UIViewController?.navigationItem.leftBarButtonItem = leftBarButtonItem

25 4 0