Używam iCarousel i muszę utworzyć własny przycisk. Chcę przekazać dane z przycisku zaprogramowanego programowo do innego widoku, ale nie mam identyfikatora segue, ponieważ programistycznie utworzyłem przycisk. Nie wiem, czy możliwe jest programowe utworzenie identyfikatora pliku.Programowo i szybko przesuwane Segue i Button
button.addTarget(self, action: #selector(buttonAction3), for: .touchUpInside)
button.setTitle("\(titulos[index])", for: .normal)
tempView.addSubview(button)
let myImage = UIImage(named: "modo4.png") as UIImage?
button.setImage(myImage, for: .normal)
let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "modo") as! Modo1ViewController
self.present(viewController, animated: false, completion: nil)
if segue.identifier == "" {
if let destination = segue.destination as? Modo1ViewController {
destination.nomb = nombres
}
}
Możliwa duplikat [przycisk Dodawanie programowo wykonać segue] (http://stackoverflow.com/questions/21241194/adding-button-programmatically-to-perform-segue) –