Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, for saving data from your app you can use Core Data or NSUserDefaults, NSUserDefaults should be use for saving small amount of data, for the rest use Core Data (there are lots of tutorials regarding core data just google it)</p> <p>But you have to rewrite your <code>cellForRowAtIndexPath</code> method because is wrongly implemented.</p> <p>First use <code>dequeueReusableCellWithIdentifier</code> to check if there are cells already created (maybe you heard about cell reuse, this is how it's done) because right now you are creating a new cell for each call of the <code>cellForRowAtIndexPath</code> is called (the method it's called every time a cell shows up on the screen). </p> <p>Second, after <code>dequeueReusableCellWithIdentifier</code> check if the cell that the method returned is nil or not, if it is nil create a new one, if not use the returned cell.</p> <p>Third, create a custom cell that can have a <code>UITextField</code> or a <code>UISwitch</code>, and in <code>cellForRowAtIndexPath</code> check the text of your <code>UITextField</code>, if is nil the set the placeholder if not leave it as it is this will allow data to be properly displayed when you scroll the table.</p> <p>Fourth, for <code>UITextFields</code> there are delegate methods that are called when user begins/end editing so you don't need to add <code>[tf addTarget:self action:@selector(textFieldFinished:) forControlEvents:UIControlEventEditingDidEndOnExit];</code>, check UITextFieldDelegate protocol (easy google stuff :))</p> <p>Fifth (the last one i promise) don't use <code>=</code> in on the same line of code, it's ugly and hard to read (<code>tf = nameFieldTextField = [self makeT...</code>)</p>
 

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