/// 配置导航 客服 private func setNavRightBar() { let rightBarItem = UIBarButtonItem(image: UIImage(named: "customerService")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), style: .plain, target: self, action: #selector(clickCustomerServiceItem)) self.navigationItem.rightBarButtonItem = rightBarItem }
2.自定义view的item
private let rightItemView = JYSelectDateRightItemView() self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: self.rightItemView)