I am new to IOS development.
In my app I want to replace the view model that’s being presented.
I show my initial view by calling: presentModalViewController
When I replace the view, I don’t want the entire animation to run.
I just simply want to change the presentModalViewController underlaying view to update.
When I set:
self.presentModalViewController.view = myCustomViewController.view
it works great for the first time, and really does replace the view
But when I try doing it again and replace the view’s content at some other point in my application’s live, the presentModalViewController does not update.
How can I update the view in presentModalViewController
It really depends of what you are trying to achieve.
1 – Does the new view has an entirely new behavior? Perhaps using a new
UIViewControllermight be a solution.2 – If you answer no to the first, then a secondary
UIViewinside the XIB will do the trick. As long as you have access to it with anIBOUtlet.Edit 1:
If you are showing it (that’s where you are), your course of action should be inside of it, and not outside. For instance: