Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Wouldn't it just be easier to put 5 text fields in a view? I don't understand why you put them in a table view... If you want them to be scrollable, you can always just wrap your entire view in a scrollview, but I wouldn't do this with a table. As far as I know, it's generally bad to use a table view for input. It's more like a way to provide a user a display of some data, e.g. an array of objects. Also, usually, if you're using an <code>NSMutableArray</code> as a data source, you would also want your table data source methods like <code>tableView:numberOfRowsInSection:</code> to return a value based on the size of the array, rather than a magic, hard coded number.</p> <p>I also see you're doing a lot of work in the code. You can have Interface Builder do all this stuff for you: just make a new <code>UIViewController</code> subclass with a xib that goes by the same name, design it in Interface Builder, and write the logic in the .m file.</p> <p>For example, let's say I have a subclass of <code>UIViewController</code> called <code>MyViewController</code>, which has a view with 1 button 'next' and 2 <code>UITextField</code>s, conveniently called <code>dateTF</code> and <code>scoreTF</code>. My .h file would look something like this:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface MyViewController : UIViewController { IBOutlet UITextField *dateTF; IBOutlet UITextField *scoreTF; } @property (nonatomic, retain) UITextField *dateTF; @property (nonatomic, retain) UITextField *scoreTF; - (IBAction)clickedNext:(id)sender; @end </code></pre> <p>Here we have a placeholder for the action that will be called when the "next" button is pressed, and 2 outlets to the text fields to retrieve the data from them. I don't need an IBOutlet to the button because I won't edit it.</p> <p>The .m file could look like this:</p> <pre><code>#import "MyViewController.h" @implementation MyViewController @synthesize dateTF @synthesize scoreTF; // called when the button is clicked - (IBAction)clickedNext:(id)sender{ NSString * date = self.dateTF.text; NSString * score = self.scoreTF.text; // do something with this data, like put up a model and go to the next view } @end </code></pre> <p>This assumes I have a xib file that contains my UI. In the xib you'll also need to make a few connections (easily done with ctrl+click_and_drag from source to target, e.g. from button to File's Owner): you'll need to connect the 2 IBOutlets and the button to call the IBAction, and you should be good to go.</p> <p>Hope this helps!</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.
    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