开发者

Set the value for Child Pane

开发者 https://www.devze.com 2023-03-17 18:19 出处:网络
Using inAppSettingsKit, I\'m trying to display the value of a Child Pane element in the summary tableCell.

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.


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 ;)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消