Closed Lalox closed 8 years ago
Hey there @Lalox.
You should never need to explicitly worry about your BOTableViewCell
's values. The idea of Bohr is to have them set up automatically depending on a certain NSUserDefaults
value. So what you actually want to do is set some value for some NSUserDefaults
key and then associate that key to whatever cell you're displaying on your BOTableViewController
. As long as the type of the default is appropriate for the cell you're using, everything (from setting to displaying that default) will be taken care of for you automatically by Bohr.
Here's some example code for a BOChoiceTableViewCell
setup:
In your AppDelegate.m
's application:didFinishLaunchingWithOptions:
:
[[NSUserDefaults standardUserDefaults] setInteger:2 forKey:@"option"];
In your BOTableViewController
subclass:
- (void)setup {
[self addSection:[BOTableViewSection sectionWithHeaderTitle:@"Section name" handler:^(BOTableViewSection *section) {
[section addCell:[BOChoiceTableViewCell cellWithTitle:@"Choice" key:@"option" handler:^(BOChoiceTableViewCell *cell) {
cell.options = @[@"Option 1", @"Option 2", @"Option 3"];
cell.footerTitles = @[@"Option 1", @"Option 2", @"Option 3"];
}]];
}]];
}
Hi David!
I have used your component, it's awesome!! I have a question I use it for create a calendar event, user can select one or multiple valid days for his event, at this point I subclassed BOTableViewController and works perfectly! but at the moment of edition I cannot found a way to "preload" multiple previous selections.
I used BOOptionTableViewCell and wrote in handler: cell.accessoryType = UITableViewCellAccessoryCheckmark; for each cell that I want to be marked but it doesn't work
Any ideas?
Thanks in advance!