7

I have been trying for a while now, but I can't figure out how to integrate InAppSettingsKit in an App, that uses Storyboard and a TabBar.

I've got my tab bar defined in a Storyboard, now I want one tab to have this InAppSettingsKit as the root view. Is this possible after all?

Thanks everyone.

Markus Kasten
  • 1,170
  • 1
  • 10
  • 15
  • Isn't it easier to create your own static tableview in the storyboard with the controls, and set the NSUserDefaults when a control is tapped. By doing this you do not need the InAppSettingsKit framework. – thvanarkel Jan 07 '12 at 17:01
  • Yes, maybe, but but I prefer InAppSettingsKit because it's very similar to the settings app and because it uses a settings.bundle. If I don't get the InAppSettingsKit I will do what you said. – Garoal Jan 07 '12 at 20:06

2 Answers2

6

Well, after trying various things, I figured out, that my problem actually was, that I put all the IASK-stuff into a static library (and I had no Settings Bundle). After moving all the code and nibs to the same project as the MainStoryboard, it worked by adding a TableView Controller to my storyboard and settings its custom class to IASKAppSettingsViewController.

Markus Kasten
  • 1,170
  • 1
  • 10
  • 15
2

Alternatively, if you want button handlers and other custom code, do following:

  1. Create a class derived from UITableViewController
  2. Modify the header file to derive from IASKAppSettingsViewController <IASKSettingsDelegate> Remove all methods but the initWithCoder and the settingsViewControllerDidEnd protocol (or make calls to super). This is so that the default UITableVC code doesn't override IASK functionality. Be sure to stick self.delegate = self; into the initWithCoder to get the buttons to work.

    //SettingsViewController.h
    #import "IASKAppSettingsViewController.h"
    
    @interface SettingsViewController : IASKAppSettingsViewController <IASKSettingsDelegate>
    @end
    
    
    //SettingsViewController.m
    // ...
    - (id)initWithCoder:(NSCoder *)aDecoder
    {
        self = [super initWithCoder:aDecoder];
        if (self) {
            self.delegate = self;
        }
        return self;
    }
    
    #pragma mark -
    #pragma mark IASKAppSettingsViewControllerDelegate protocol
    - (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender {
        [self dismissViewControllerAnimated:YES completion:nil];
    }
    
  3. Set custom class of the table view in storyboard to your class

Nav
  • 1,185
  • 16
  • 23
  • 1
    Just wanted to report this worked perfectly in Xode 5 / ios6/7. I have a TabBarController with a SettingsviewController as described above. – mox1 Feb 26 '14 at 01:14