I am using swift 4
I have a tab bar controller where I created a programmatically button in the middle of the tab bar. Upon button click I want to perform segue and show the next view. I created the segue from the tabar view to the next view and named it moveToNext.
here is the button
let button = UIButton.init(type: .custom)
override func viewDidLoad() {
super.viewDidLoad()
let blue = UIColor(red: 53/255, green: 92/255, blue: 125/255, alpha: 1.0)
UITabBar.appearance().tintColor = blue
button.setTitle("+", for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 32)
button.setTitleColor(.white, for: .normal)
button.setTitleColor(.white, for: .highlighted)
button.backgroundColor = blue
button.layer.cornerRadius = 32
button.layer.borderWidth = 1.5
button.layer.borderColor = blue.cgColor
//button.layer.borderColor = UIColor.green.cgColor
button.addTarget(self, action:#selector(self.buttonClicked), for: .touchUpInside)
self.view.insertSubview(button, aboveSubview: self.tabBar)
UITabBar.appearance().backgroundImage = UIImage.colorForNavBar(color: .white)
UITabBar.appearance().shadowImage = UIImage.colorForNavBar(color: blue)
}
@objc func buttonClicked() {
print("Button Clicked")
self.performSegue(withIdentifier: "moveToNext", sender: self)
}
I get the following error
'Receiver (<Pac.CustomTabBarViewController: 0x7fc94285be00>) has no segue with identifier 'moveToNext''
*** First throw call stack:
Im fairly new to swift and Xcode, and come from java background.
I think I am performing the segue correctly. Why can't it find the segue and how can I fire it from the button click?
Thanks for taking the time to read this and help me.