Swift: How do I add a button to the InAppSettingsKit setting view (iPhone/iPad)?

754 Views Asked by At

I followed the instructions in "How do I add a button to the InAppSettingsKit setting view (iPhone/iPad)?" I have the button appearing in the settings screen. However, I can't receive input when clicked. my bridge header:

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

my class:

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

There are 1 best solutions below

1
jlo-gmail On

To catch the button tap, set the delegate to receive callbacks:

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