Sabtu, 27 Juli 2019

Making a Segue Between Storyboard Part II #IOSDev

Hello everyone, in this tutorial i would like to continue my last tutorial about segue, if you dont have read it yet, just go to this link.

in this tutorial i would like to show you how to switch between view controller using programmatically in swift. interesting right? so here it is.

prerequisite:
* create new project
* know how to put segue by drag and drop


firstly, open last xcode project about segue in the first tutorial. and then add new viewcontroller. like bellow



connect segue from first viewcontroller to third viewcontroller by dragging first viewcontroller icon and drop it to third viewcontroller, you could use ctrl+click to drag and drop. after you drop, you will face new popup window, choose "show" like bellow 




click on the segue path link like bellow



on the right side bar, you will see some menu, choose the attribute menu. and then you can see identifier option right there. fill the identifier as you want, in this tutorial we put "seguePartII" as the name.



add button (name: hit me) to first viewcontroller and label in second view controller, we will use it as marker whether the view controller is moving to second view controller or not. 



we are now done with the UI, lets start the code. wohoo

click the viewcontroller.swift, and then add action from button (hit me). and then put perform segue code into it.



finally, run it and tap on hit me button, and see whats going on.  good luck guys ^_^

0 komentar:

Posting Komentar

Search