Tutorial :How can I create dynamically updated views in a tab bar view, based on settings selection?



Question:

Noob question....

I've created a Tab Bar application. It has four tabs and works fine. Each view is created with a XIB and is effectively static. Each view takes user input and responds on screen.

What I need to be able to do is change the input options the user have - in effect remove some UITextFields dependant upon which option the user selects in settings.

I've created root.plist and created settings no problem i've also created additional XIBS for the altered UI, but what I don't know how to do, is call these into the tab view controller on demand. Effectively tab one has 3 possible views, tab two 3 possible views etc. But I only want the one that's relevant for the users settings selction to be displayed?

Make sense?

For reference, if we call the different views - UIInputViewA1, ...A2,....A3 UIInputViewB1,....B2....B3 etc.

Hope someone can help, been trawling the net for nights trying to get my head round this. Beggining iPhone Development Bible doesn't help either.

If you need any more info, please shout.

Cheers

Paul.


Solution:1

Instead of completely swapping one xib for another, why not just add/remove the controls programmatically based on the settings? Just make sure you have all the controls in your xib linked to outlets in your File Owner so you can access them all from code. For a start point, just send the "hide" message to the controls you want to hide. Later, you should learn how to properly remove and deallocate those controls if they aren't needed any longer.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »