1aurabrown/FODFormKit — pull request #2 by 1aurabrown (2014-01-27 17:02:15+00:00)
Title: @orta -> update to cell factory, and changes to the view controller

This includes my changes from the PR that I sent you before, plus some updates. Still more refactoring to do, but these few changes make it easier to modify the form in our own (and hopefully anyone's own) project.

I have some corresponding eigen changes, but obviously they just won't work unless this pod is also updated.

Some of the changes are:
* FODCellFactory now has a method `cellToNibMap` which returns a dictionary, which can be overwritten in a subclass of the factory. In ARFormCellFactory, I have:

```objective-c
+ (NSDictionary *)cellToNibMap
{
NSMutableDictionary *nibMapCopy = [NSMutableDictionary dictionaryWithDictionary:[[[self class] superclass] cellToNibMap]];
[nibMapCopy addEntriesFromDictionary:@{
@"TextInputCellNoTitle" : @"ARTextInputCell",
@"TextInputCellWithTitle" : @"ARTextInputCell2",
@"SwitchCell" : @"ARSwitchCell"
}];
return [NSDictionary dictionaryWithDictionary:nibMapCopy];
}
```
* FODFormViewController was explicitly initializing an instance of FODCellFactory. Since we want to be able to subclass this, I added a method `- (Class)classForFactory` which will return our own `[ARFormCellFactory class];` in our controller. Now we call

```
self.cellFactory = [[[self classForFactory] alloc] initWithTableView:self.tableView
andFormViewController:self];
```
instead of a hard-coded class.

* There was also a bunch of stuff being done in FODFormViewController's viewDidLoad and it seemed messy to call [super viewDidLoad] and then change 50% of what this method call sets up. I broke the code in viewDidLoad into separate methods that are called individually and can be overwritten individually. For example, there are a save and cancel button that are initialized, but in our app they aren't even displayed, and because we want to post data whenever a user moves focus out of an text area or whenever they toggle a button, they aren't necessary. Now the creation of these buttons is in its own method that we can override to just do nothing. Similarly, we want to be able to independently customize the table view and will also probably want to customize the little arrow buttons to navigate between fields, so I broke each of these components of viewDidLoad into their own methods which can be customized separately. I don't know if this is the best way to be doing this, but it seems a little easier to manage and customize now.

Anyway give me your feedbacks plz @orta. I will put the eigen changes up too, which depend on these changes, so you can see them side by side.