In my Xcode project I have a view controller class
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var refreshButton: UIBarButtonItem!
var refreshUiButton = UIButton()
override func viewDidLoad() {
super.viewDidLoad()
refreshUiButton.setImage(#imageLiteral(resourceName: "refresh"), for: .normal)
refreshUiButton.imageView?.contentMode = UIViewContentMode.scaleAspectFit
refreshUiButton.addTarget(self, action: #selector(didRefreshClicked(_:)), for: .touchUpInside)
refreshButton.customView = refreshUiButton
}
and here what it looks like
The button covers segmented control in the middle of navigation panel.I have an extension for UIButton, because of it I want to use UIbutton as a custom view for UIBarButtonItem.
I want it to look like this
How can I organize that?
It's seems that your button image has incorrect size. If I right you need sizes according Human Design . Or you can change tint color for system barButtonItem to black.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.