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
Post a Comment