mardi 24 février 2015

Add Programmatically added textField's text to sqlite database

I have sqlite implemented in my xcode project. It gets its data from a UITextField. There is a texField that gets added programmatically everytime the user clicks a button. I will be recreating the 'same' textField. (Kind of.) How can I get the textField's data to the sqlie file?


SQLite Created in Terminal



CREATE TABLE myDB(myDBID integer primary key, first text, second text);


Objective C



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

//IBAction:
UITextField *text = [[UITextField alloc] initWithFrame:frame];
[self.view addSubview:text];


How can I add the programmatically added textField's text to the sqlite database?


Aucun commentaire:

Enregistrer un commentaire