Let me start with I'm a beginner with Xcode and Cocoa. I have fooled around with it on and off for years, doing small utilities for myself. Using Xcode 5.1.1 on Mavericks.
I am working on a small program that uses Core Data. I have followed a tutorial and have everything working using bindings and an array controller. Now I am trying to polish it a bit and this is where I usually run into problems. I want to add a sheet so when you press the add button, instead of the table just adding a row and editing in the table, the window would present a sheet and you would enter your new data there.
Now to question 1...
I was able to make it work by subclassing the NSArrayController and overriding the add: method but also letting it act as an AppContoller as well, setting up IBOutlets to the sheet and window and making a closeSheet method to close the sheet. Is this the correct way to go about this? (See Question 2)
Question 2...
I don'd think this is the proper way to do this. I assume the proper way would be to make an AppController class, connect the add button to it, let the AppController present the Sheet and then ask the ArrayController to add a new record. Then the close button would tell the AppController to close the sheet. If this is the proper way, I am lost on how to call an ArrayController method from within my AppController.
Thanks for any help.
I am working on a small program that uses Core Data. I have followed a tutorial and have everything working using bindings and an array controller. Now I am trying to polish it a bit and this is where I usually run into problems. I want to add a sheet so when you press the add button, instead of the table just adding a row and editing in the table, the window would present a sheet and you would enter your new data there.
Now to question 1...
I was able to make it work by subclassing the NSArrayController and overriding the add: method but also letting it act as an AppContoller as well, setting up IBOutlets to the sheet and window and making a closeSheet method to close the sheet. Is this the correct way to go about this? (See Question 2)
Question 2...
I don'd think this is the proper way to do this. I assume the proper way would be to make an AppController class, connect the add button to it, let the AppController present the Sheet and then ask the ArrayController to add a new record. Then the close button would tell the AppController to close the sheet. If this is the proper way, I am lost on how to call an ArrayController method from within my AppController.
Thanks for any help.