func createFakeAndSearchCurrentLocationBarButton (vw: UIViewController) {
let fakeCurrentLocationGo = UIButton(type: .custom)
fakeCurrentLocationGo.setImage(UIImage(named: "reallocationgo50"), for: .normal)
fakeCurrentLocationGo.frame = CGRect(x: 0, y: 0, width: 20, height: 20)
fakeCurrentLocationGo.addTarget(vw, action: #selector(goToMyCurrentLocationPin), for: .touchUpInside)
let leftItem = UIBarButtonItem(customView: fakeCurrentLocationGo)
let searchLocationBtn = UIButton(type: .custom)
searchLocationBtn.setImage(UIImage(named: "search"), for: .normal)
searchLocationBtn.frame = CGRect(x: 0, y: 0, width: 15, height: 15)
fakeCurrentLocationGo.addTarget(vw, action: #selector(searchLocationHandle), for: .touchUpInside)
let rightItem = UIBarButtonItem(customView: searchLocationBtn)
vw.navigationItem.setRightBarButtonItems([leftItem,rightItem], animated: true)
}
skąd dodany przycisk? – Johnykutty
Chcę ustawić przycisk tylko kliknięcie z ramką, ale wywołuje tę metodę, gdy klikam na zewnątrz przycisku –