设置子窗格的值
使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据苹果的规范,子窗格并不是真正为此设计的。也就是说,当然可以添加对此的支持。查看
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 setcell.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:
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.