Reputation: 317
How to Move to the Next Controller with a single click of a Button? There is no data transfer, only one click of button and it will proceed to the next controller.
I created a controller named "ViewIntro" which is the initial controller. It's basically a Welcome Screen and there is a button at the bottom.
Once the button is clicked, it will proceed to the viewController which is the original controller whenever we start an xcode project I forgot to make the viewController as my welcome screen
Anyways, here is my current code of my ViewIntro:
`import Foundation import UIKit
class ViewIntro : UIViewController{
@IBOutlet weak var btnEnter: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}`
I also had connected the ViewIntro to ViewController through identifier as shown in the attached image.
Upvotes: 1
Views: 176
Reputation: 2800
Right click your button and drag it to your controller. Just like creating an IBOutlet
but you should select Action mode. Afret creating an IBAction
for your button, just add this code into it:
self.performSegue(withIdentifier: "showMain", sender: nil)
Upvotes: 1