设置子窗格的值

发布于 2024-11-18 13:41:19 字数 930 浏览 2 评论 0原文

使用 inAppSettingsKit,我尝试在摘要表单元格中显示子窗格元素的值。

TableCell 正确显示标题,但不显示值:/

这是我的 Root.plist 文件的片段:

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

我的 [NSUserDefaults standardUserDefaults] 文件如下所示:

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

我还显示多值单元格,它的工作原理就像一个魅力...

任何人帮我 ?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小瓶盖 2024-11-25 13:41:19

根据苹果的规范,子窗格并不是真正为此设计的。也就是说,当然可以添加对此的支持。查看 IASKAppSettingsViewController.m 中第 500 行左右,并将 cell.detailTextLabel.text 设置为 [self.settingsStore objectForKey:key] 或您的 defaultValue。

如果您付出额外的努力并将其包装在一个不错的额外选项中,我们很乐意包含您的贡献;)

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

舂唻埖巳落 2024-11-25 13:41:19

感谢奥特温的回答。由于并非所有子窗格都应显示值,因此我将代码更改为:

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

我认为我们不需要另一个键,因为它以前并未用于子窗格。这将是官方版本的一个很好的补充。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文