没有直接的方法来使用
UIBarButtonItem
APIs创建这样的条形按钮.
您可以使用配置了.InfoLight UIButton的自定义视图,如建议的here:
// Create the info button let infoButton = UIButton(type: .infoLight) // You will need to configure the target action for the button itself,not the bar button itemr infoButton.addTarget(self,action: #selector(getInfoAction),for: .touchUpInside) // Create a bar button item using the info button as its custom view let infoBarButtonItem = UIBarButtonItem(customView: infoButton) // Use it as required navigationItem.rightBarButtonItem = infoBarButtonItem
如果您需要更多帮助,请随时发表评论.