如何在InAppSettingsKit设置视图(iPhone / iPad)中添加按钮? [英] How do I add a button to the InAppSettingsKit setting view (iPhone/iPad)?

查看:137
本文介绍了如何在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:

我想在我的应用程序中集成一个名为reset的红色按钮,但是我不知道该怎么做。我已经看过示例应用程序中的代码了,我有点迷失了。请有人帮帮我吗?

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?

推荐答案

在花了一段时间搜索所有代码和plists之后我找到了答案我的问题。对于那些感兴趣的人,您需要做的是以下内容:

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:


  1. 在Root.plist文件中添加一行,并将Type设置为 IASKButtonSpecifier

  2. 将此行上的标识符设置为有用的内容,例如'myButton1'。

  3. 将以下委托方法添加到您从以下位置加载InAppSettingsKit的viewController:

  1. Add a row to your Root.plist file with the Type set to IASKButtonSpecifier.
  2. Set the Identifier on this row as something useful e.g. 'myButton1'.
  3. Add the following delegate method to the viewController you loaded the InAppSettingsKit from:

- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForKey:(NSString*)key 
{
    if ([key isEqualToString:@"myButton1"]) 
    {
       // Do some actions...
    }
}


值得注意的是,密钥等于你在Root.plist中设置的标识符。

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.

这篇关于如何在InAppSettingsKit设置视图(iPhone / iPad)中添加按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆