mardi 24 février 2015

Add data to sqlite from a textField

What I'm trying to do is, add the text from a textField that doesn't initially exist, (it will be added programmatically with an IBAction,) then add the text from the textField to a row in sqlite. The reason why I can't do like so:



NSString *query = [NSString stringWithFormat:@"insert into myDB values(null, '%@')", self.textView1.text];
[self.dbManager executeQuery:query];


is because I don't know how many textFields the user will add, therefore, I won't be able to enter a specific amount of rows in the sqlite file.


This is a bit complicating. If this wasn't clear enough, then here is an example:


Like in apples contact app, when you create a new contact, you can add how ever many phone numbers you want, (I don't think they limit it), and if they're using sqlite, how do they know how many rows to add in the table?:


enter image description here


Aucun commentaire:

Enregistrer un commentaire