there are different conditions for same design file. i can't use if-else in same class file to differentiate them. because manage all conditions are difficult. is there any way to change class at dynamic time.
How to change class dynamically for view controller using interface builder
Asked Answered
Have a look here on how to do it with NIB files. https://mcmap.net/q/174128/-how-to-use-single-storyboard-uiviewcontroller-for-multiple-subclass –
Sasaki
Look here on doing it with Storyboard. https://mcmap.net/q/174128/-how-to-use-single-storyboard-uiviewcontroller-for-multiple-subclass –
Sasaki
Yes, we can set class using Xib. But from my research i didn't find any way to change storyboard class dynamically. I found other way to reuse the view like using container view. following link shows how can we reuse storyboard view. Diego Lavalle describe it on medium.
and you can read about container view at here.
I think you can use a master view controller and can load different view controllers as child based on some condition.
For example in Master View controller you can use UIsegmentedControl and based on the option the user chooses, you can show different view controllers.
Refer the following for implementing the same.
© 2022 - 2024 — McMap. All rights reserved.