ios - Segue Methods and Their Objectives -


when press button, want initiate new view controller , want pass information new view controller. handled without segue methods using global variables.

however, if use segue method, 1 of them have use ?

performsegue() or shouldperformsegue()

you have call

func performsegue(withidentifier identifier: string,             sender: any?) 

the above method initiate segue , can push next view controller.

for info

func shouldperformsegue(withidentifier identifier: string,                   sender: any?) -> bool 

the method return boolean value, specify if perform segue or not. have controller on , can allow segue perform or not return true/false method.

true - segue allowed , performed

false - segue not allowed , aborted.

you can use method if want override segue have defined in storyboard , want perform other @ run time.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -