ios - How can i replace a IBOutlet uiview programmatically with a custom view in swift -


it has replacementview uiview in storyboard

@iboutlet var replacementview: uiview! 

connected.

i want replace replacementview with

replacementview = secondviewcontroller().view 

but doesn't work. problem?

replacementview reference. have change object in view stack.

you should keep reference replacementview's parent. next remove replacementview parentview , add secondviewcontroller().view parentview.

i suggest try add secondviewcontroller().view replacementview , add fill constraints.

you should remember retain secondviewcontroller, otherwise dealocated before appear. read addchildviewcontroller(childcontroller: uiviewcontroller) uiviewcontroller method.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -