Y
Y
Yurka Makarov2017-06-04 01:30:31
Swift
Yurka Makarov, 2017-06-04 01:30:31

Xib on button click switch to view controller?

There is xib that appears when you click on a marker on the map.
It is defined as uiview, there is a button in this xib.
How to make a transition to another screen.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yurka Makarov, 2017-06-06
@foxkids94

Resolved the issue.
Added a button in the XIB class as @IBOutlet.
func mapView(_ mapView: MKMapView,
didSelect view: MKAnnotationView)
{
let button2 = UIButton(frame: calloutView.GotoProfileUsr.frame)
button2.addTarget(self, action: #selector(ViewController.ProfileInfo(sender:)), for: . touchUpInside)
calloutView.addSubview(button2)
}
And hung up the handler.
func ProfileInfo(sender: UIButton){
performSegue(withIdentifier: "id", sender: self)
func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let vc = segue.destination as? ProfileUsersViewController
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question