davdroman / Bohr

Settings screen composing framework
MIT License
1.26k stars 83 forks source link

Nothing happens in BOOptionTableViewCell #21

Closed n1mda closed 8 years ago

n1mda commented 8 years ago

// AppDelegate.m

[[NSUserDefaults standardUserDefaults] registerDefaults:@{
                                                              @"settings.language": @0,
                                                              }];

// SettingsTableViewController.m

[self addSection:[BOTableViewSection sectionWithHeaderTitle:DPLocalizedString(@"settings.navbar.title", nil) handler:^(BOTableViewSection *section) {

        [section addCell:[BOChoiceTableViewCell cellWithTitle:DPLocalizedString(@"settings.table.language", nil) key:@"settings.language" handler:^(BOChoiceTableViewCell *cell) {
            cell.options = @[@"English", @"Swedish", @"Russian", @"Uzbek"];
            cell.destinationViewController = [LanguageSettingsViewController new];
        }]];

    }]];

// LanguageSettingsViewController.m

- (void)setup {

    self.title = DPLocalizedString(@"settings.table.language", nil);

    [self addSection:[BOTableViewSection sectionWithHeaderTitle:DPLocalizedString(@"settings.table.language", nil) handler:^(BOTableViewSection *section) {

        [section addCell:[BOOptionTableViewCell cellWithTitle:@"English" key:@"settings.language" handler:nil]];

        [section addCell:[BOOptionTableViewCell cellWithTitle:@"Swedish" key:@"settings.language" handler:nil]];

        [section addCell:[BOOptionTableViewCell cellWithTitle:@"Russian" key:@"settings.language" handler:nil]];

        [section addCell:[BOOptionTableViewCell cellWithTitle:@"Uzbek" key:@"settings.language" handler:nil]];

    }]];

}

It displays LanguageSettingsViewController but nothing happens when I select any of the options.

n1mda commented 8 years ago

Keys can't have dot notation in them... Worked fine by using language_settings instead of settings.language

davdroman commented 8 years ago

Glad you found out the answer! Sorry for not replying, I'm not home this weekend.