Basically, this is a noob question. Forgive. 🙁
Every example in books or on the web I’ve seen uses add remove buttons with a Table to create an instance of a managed object. I can do this. I have done this. But I’d rather not do this. I’d much rather use an NSForm and click an “add” button to create the instance and add it to the database.
I’m sure this just needs to be a method on the button itself. It fetches values from the form such as name, age… whatever and then when add is clicked, it adds that to the table and to the data base.
I did find some material that showed me how to “manually” create a MO instance, but then, I couldn’t set the properties / attributes of that instance using
newStudent.firstName = [[form cellAtIndex:1] stringValue];
Would I need to create a class for Student and set properties there? Am I just missing something stupid? My noob instincts tell me this isn’t the best approach. There’s got to be a more elegant touch.
Any suggestions welcome. I’m new to OS programming and even newer to Core Data. Thank you very much.
You can create object of MO class student using:
now you can use: