Search code examples
iosuitextfielduitextviewsurveyscroll-paging

Load a survey with multiple uitextfield and uitextview from local text file


I am trying to develop an application one of whose features is a survey form. This survey could change from time to time. So I thought, the best way to go about it would be to notify the user of a newer version of the survey and let him download it as a text file. Once downloaded, I would process the text file for some pre-defined tags and then load it as a survey form on to his screen with multiple text fields and textviews. Are there any sample codes available that show how we can code these different tags that can processed later before showing a survey scroll view.

For example: I can have [Question] for a textview and [Empty] for a textfield and [Multiple] for a multiple choice answer possibility. Similarly [[Start]] and [[End]] for starting and ending the text to be processed.

I have tried to search online for better methods of doing this. I came across this question where a webview is suggested, but I need the survey to be available offline so the user could save his answers and continue/change them later.


Solution

  • You should probably use 1 of the many standard formats used to store and manage data like XML:

    <Question text="What is...?" /> 
    

    for a basic user input question

    <Question text="What is...?">
      <Answer text="Option 1">
      <Answer text="Option 2">
    </Question>
    

    for a multiple choice question

    etc.