如何将按钮添加到 InAppSettingsKit 设置视图 (iPhone/iPad)?
我一直在查看 InAppSettingsKit 提供的示例应用程序,我注意到使用了几个按钮:
我想在我的应用程序中集成一个名为“重置”的红色按钮,但我不知道该怎么做。我查看了示例应用程序中的代码,但我对这一切有点迷失。请问有人可以帮我吗?
I have been looking at the sample app provided by InAppSettingsKit and I noticed the use of a couple of buttons:
I would like to integrate a single red button in my app called reset, however I'm not sure how to do it. I've had a look at the code in the sample app and I'm a bit lost with it all. Please could someone help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在花了一段时间搜索所有代码和 plist 后,我设法找到了我的问题的答案。对于那些感兴趣的人,您需要执行以下操作:
IASKButtonSpecifier
。将以下委托方法添加到您从中加载 InAppSettingsKit 的 viewController:
值得注意的是,该键等于您在 Root.plist 中设置的标识符。
我唯一还没弄清楚的是如何改变按钮的颜色;但是我怀疑这可以通过重写方法来实现。
After spending a while searching through all the code and plists I managed to find the answer to my question. For those who are interested what you need to do is the following:
IASKButtonSpecifier
.Add the following delegate method to the viewController you loaded the InAppSettingsKit from:
It's worth noting that the key is equal to the identifier you set in the Root.plist.
The only thing I haven't worked out yet is how to change the colour of the button; however I suspect this may be possible by overriding a method.
很高兴您已经找到了部分解决方案。要自定义外观,您应该使用 http://www 上记录的
IASKCustomViewSpecifier
创建自定义视图.inappsettingskit.com/。例如,黄色图标就利用了这一点。在您的情况下,您可以返回具有红色背景颜色(或自定义背景图像)的 UIButton 实例。在这种情况下,您不需要 buttonTappedForKey 方法来获取点击事件,而是像往常一样配置按钮的目标/操作。
Great that you already found part of the solution. To customize the look, you should create a custom view using the
IASKCustomViewSpecifier
documented on http://www.inappsettingskit.com/. The yellow icon for instance is making use of this. In your case, you could return an instance of UIButton with a red background color (or a custom background image).In this case, you don't need the buttonTappedForKey method to get the tap event but configure the target/action of your button as usual.