1

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")
    }
}
Community
  • 1
  • 1
jlo-gmail
  • 4,453
  • 3
  • 37
  • 64

1 Answers1

4

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)")
    }
}
Ortwin Gentz
  • 52,648
  • 24
  • 135
  • 213
jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
  • I have to add `IASKSettingsDelegate` and implement `func settingsViewControllerDidEnd(_ sender:IASKAppSettingsViewController)` to make the button work (in XCode 8.2.1 and Swift 3) – Tun Aug 26 '17 at 07:33