Instant segue before presentation

I am trying to figure out the correct viewcontroller / segue structure for my project and I need help.

When " B " is displayed from " A ", it checks to see if the statement is true. Only if true, " C " should be immediately presented instead of " B ". The user continues to " D ", and disconnect from " D " disconnect to " B ".

Segue example

I could check the if-statement in viewDidAppear()from B ', but then the view will load first a few milliseconds before loading the C view manager . This does not look good.

If I try to make an if-statement in viewDidLoad(), I get an error message:

An attempt to present a ' C ' on ' B whose view is not in the window hierarchy

Maybe there is a better way to do this?

+4
source share
2 answers

segues, ViewController, . Segues , ViewController , viewDidLoad, .

ViewController segues - , " ", A->B->C , B, A->C. segue C A B.

, , unind segue ViewController, . , , "" . , "" , , segue say D->B, "" B, segues A->C->D->B.

0

, . viewcontroller, - " B", " C". , :

func switchToB() {
    containerB.isHidden = false
    containerC.isHidden = true
}

func switchToC() {
    containerB.isHidden = true
    containerC.isHidden = false
}

' D' , switchToC().

0

Source: https://habr.com/ru/post/1684121/


All Articles