pierrefevrier
pierrefevrier

Reputation: 1650

Set the value for Child Pane

Using inAppSettingsKit, I'm trying to display the value of a Child Pane element in the summary tableCell.

TableCell correctly display the Title but not the value :/

Here is a snippet of my Root.plist file:

<dict>
    <key>IASKViewControllerClass</key>
    <string>SetupBirthViewController</string>
    <key>IASKViewControllerSelector</key>
    <string>init</string>
    <key>Key</key>
    <string>settings_birthYear</string>
    <key>Title</key>
    <string>Né(e) en</string>
    <key>Type</key>
    <string>PSChildPaneSpecifier</string>
</dict>

And my [NSUserDefaults standardUserDefaults] file is like bellow:

<dict>
    <key>settings_birthYear</key>
    <string>2009</string>
    <key>enable_preference</key>
    <true/>
</dict>

I also display Multi Value cell and it works like a charm...

Anyone to help me ?

Thanks.

Upvotes: 0

Views: 592

Answers (2)

Falko
Falko

Reputation: 11

Thanks Ortwin for your answer. Since not all child panes shall display a value I changed the code to:

      if ( key ) {
        cell.detailTextLabel.text = [self.settingsStore objectForKey:key];
      }

I don't think we need another key since it was previously not used for child panes anyway. Would be great addition to the official version.

Upvotes: 1

Ortwin Gentz
Ortwin Gentz

Reputation: 54113

Child panes aren't really designed for that according to Apple's spec. That said, it'd be certainly possible to add support for this. Look at around line 500 in IASKAppSettingsViewController.m and set cell.detailTextLabel.text to [self.settingsStore objectForKey:key] or your defaultValue.

If you do the extra mile and wrap that in a nice little extra option, we'd be happy to include your contribution ;)

Upvotes: 1

Related Questions