Swift:如何在InAppSettingsKit设置视图(iPhone / iPad)中添加按钮?

时间:2015-08-28 20:15:33

标签: ios swift inappsettingskit

我按照" How do I add a button to the InAppSettingsKit setting view (iPhone/iPad)?"中的说明进行操作。我的按钮出现在设置屏幕中。 但是,单击时我无法接收输入。 我的桥头:

#include <UIKit/UIKit.h>
#import "InAppSettingsKit/IASKViewController.h"
#import "InAppSettingsKit/IASKAppSettingsViewController.h"
#import "InAppSettingsKit/IASKSpecifier.h"
#import "InAppSettingsKit/IASKSettingsReader.h"

我的班级:

class settingsViewController: IASKAppSettingsViewController
{
    func settingsViewController(sender: IASKAppSettingsViewController, buttonTappedForSpecifier specifier: IASKSpecifier)
    {
        println("click")
    }
}

1 个答案:

答案 0 :(得分:4)

要捕捉按钮点按,请将委托设置为接收回调:

import UIKit;
class settingsViewController: IASKAppSettingsViewController
{
    override func viewDidLoad()
    {
        self.delegate = self
    }
    func settingsViewController(sender: AnyObject, buttonTappedForKey key: String)
    {
         println("click \(key)")
    }
}