you're reading...
Social Media

Hands-on with @sensibleCocoa #iOS tableView framework – I see light in the tunnel!

I've got the "Sensible Tableview" installed. I've passed the videos one more time, and now I'm hands-on. Yesterday I tried a small project with some accounting database stuff. But ran into endless problems. So I decided to follow the Core Data video instead, trying to undersand the sensible way.

The video however is showing a XCode 3 project, so there are some small differences. And as "the devil is in the details" it is also present here, and I tumbled. But finally I got it right. 

XCode4 has a navigation project template with an example database application that runs out of the box. There isn't any editing posibility however. But by adding a bit of @sensibleCocoa magic, you suddenly get it!

Here is what I did:

Create a new Navigation project with Core Data called navTest

Changed the rootviewcontroller.h to:

#import <UIKit/UIKit.h>

#import <CoreData/CoreData.h>

#import "SCTableViewModel.h"

@interface RootViewController : UITableViewController <SCTableViewModelDataSource> {



    NSManagedObjectContext *managedObjectContext;

SCTableViewModel *tableModel;


@property (nonatomicretainNSManagedObjectContext *managedObjectContext;


Changed the rootviewcontroller.m to:

#import "RootViewController.h"

@implementation RootViewController

@synthesize managedObjectContext = __managedObjectContext;

– (void)viewDidLoad


    [super viewDidLoad];

    // Set up the edit and add buttons.

    self.navigationItem.leftBarButtonItem = self.editButtonItem;

    UIBarButtonItem *addButton = [[UIBarButtonItem alloc

                initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self 


    self.navigationItem.rightBarButtonItem = addButton;

    [addButton release];


    SCClassDefinition *eventDef = [SCClassDefinition 





    tableModel = [[SCTableViewModel alloc

                initWithTableView:self.tableView withViewController:self];

    // Create and add the objects section

SCArrayOfObjectsSection *objectsSection = [SCArrayOfObjectsSection 



    objectsSection.addButtonItem = self.navigationItem.rightBarButtonItem;

    [tableModel addSection:objectsSection];


– (void)dealloc


    [tableModel release];

    [__managedObjectContext release];

    [super dealloc];


Run it and change the records. It works!


About mortjac

Norwegian social entrepreneur, blogger&Swift programmer. PM for the OMG GL standard. Using #ULab to give #Villajoyosa sustainable tourism&tunable pipe organs.


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: