Note that there are some explanatory texts on larger screens.

plurals
  1. POHow should I dynamically create a form in iOS?
    primarykey
    data
    text
    <p>I'm creating an iPhone app and I need the ability to dynamically create a "form" where a user can input data. For example, suppose I was making the Dominoes Pizza app where you can order pizza through a in-app "form". This form has different section headings (Pizza, Pasta, Salad...etc) different "radio button" like options (Meat pizza, cheese pizza...etc) and some condition options (for example, you might only see options for pizza toppings if you have selected the pizza checkbox). My app will be similar to that, with a form with many checkboxes, radio buttons, drop downs...etc.</p> <p>My question is what would be the best way to store the information used to dynamically create such a form? My requirements are that it be easy to change (say cheese pizzas now cost $2 more) and it should be able to be changed by a person with limited programming experience.</p> <p>My first instinct would be to use XML such as this:</p> <pre><code>&lt;Item&gt;Pizza&lt;/Item&gt; &lt;Type&gt;Dropdown List&lt;/Type&gt; &lt;Cost&gt; $5.0 &lt;/Cost&gt; &lt;Option&gt; Cheese Pizza &lt;/Option&gt; &lt;Option&gt; Pepperoni Pizza &lt;/Option&gt; &lt;Option&gt; Meat Pizza &lt;/Option&gt; &lt;Item&gt;Salad&lt;/Item&gt; &lt;Type&gt;Radio Buttons&lt;/Type&gt; &lt;Cost&gt; $2.0 &lt;/Cost&gt; &lt;Option&gt; Yummy Salad &lt;/Option&gt; &lt;Option&gt; Icky Salad &lt;/Option&gt; </code></pre> <p>Having this file in my app, I could then just parse this and whenever I see a "Radio button" type, create a radio button and whenever I see a "Drop down list" create a drop down list. The only issue with this is it may make it difficult to make conditional options such as only show salad item if the use has already selected a pizza.</p> <p>Is this the most appropriate technology to use for this case? XML? Note that I don't want it to strictly be a web app because I want to be able to use Objective-C objects such as "UISegmentedControl".</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload