July7
Had a bit of an issue that took me a bit of head scratching. I had a UITableView which worked perfectly in iPhone API 2.2 but in 3.0 the insert/delete icons weren’t being displayed. Reworked and checked all the code but nothing worked.
It seems if you set the editing flag to YES when creating the tableViewCell’s, the insert/delete icon applied by the table delegate (editingStyleForRowAtIndexPath) isn’t displayed. Removing the call to cell.editing seems to fix the problem. This seems to be one of those things that is slightly different between iPhone OS 2.2 and 3.0.
April6
I was having a discussion with R. Tyler about getting 2 entities to combine into 1 table using CoreData/Cocoa Binding. We stretched the NSArrayController in all sorts of ways trying to get it to do something that it didn’t want to do.
Anyway I had a think about it over dinner, and it occurred to me that the solution probably isn’t in Interface Builder but in the model itself. After a bit of fiddling and some trial and error I found that it wasn’t too hard to accomplish. The basic twist that is needed is that you should have an abstract entity which is a parent for the two entities that you wish to combine.
The hook an array controller up to the parent entity and it will display all of the appropriate records. The only gotcha I found was that if your two entities have different fields that you want to display the missing fields will have to be added to the entity. Set these to transient so that the data saved in them will be ignored during saves.
I have a simple sample project up to demonstrate what is happening.
April4
I have started working with core data for a couple of days now and I have a few first impressions:
The initial core data videos and tutorials take the easy path and show you the add a row to the table/delete a row from the table type example. The first version of Body Diary worked this way and I had a number of complaints about the user interface. It takes a little more effort to get this working correctly.
The bindings dialogs aren’t really intuitive. As I get used to the interface I am sure that I will understand it better once I have used it for a while.
I like the core data entity and relationship mapping. To me it feels like building a ER diagram for a database without having to worry about primary keys and foriegn key mappings. I would like to be able to drag and drop the relationships but that is probably a symptom of me spending to much time using Visio to document peoples databases.
In all I can see how core data will help me be more productive. Hopefully I will be able to climb up the initial learning curve in the next couple of days (I only get a couple of hours a day to work on Body Diary) and then bask in the speed that is developing applications using core data.
April2
I have decided to rewrite Body Diary using Core Data, after seeing Apple’s video tutorials on Core Data. Previously Body Diary hasn’t used either Core Data or Bindings, so this version will be a complete rewrite. The reason for using core data are:
- Faster coding
- No coding of sorting/filtering routines
- Should create an app with better stability
- I probably should learn these brand new technologies
Body diary is a pretty simple application so it should be an easy introduction for me to Core Data. The only real challenges I see with Body Diary are:
- Need custom code to handle the charting module
- Need code to import existing Body Diary files.
Also body diary will have a couple of new options. The main request people have is that they want to include an extra field or two. The main problem is that different people want to include different fields. Therefore I hope to incorporate the option to add any number of additional fields to the body diary application, and to chart those fields. The other main request is
for the charting module to show a floating average on the chart. I will also include the option to filter the results so you can view the graph for a set time frame.
Before diving in I thought I would read up a bit on Core Data. I have found the following useful: