Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly integrate InAppSettingsKit with Storyboard in a TabBar?

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.

like image 547
Markus Kasten Avatar asked Dec 15 '11 20:12

Markus Kasten


2 Answers

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.

like image 56
Markus Kasten Avatar answered Nov 12 '22 19:11

Markus Kasten


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

like image 37
Nav Avatar answered Nov 12 '22 20:11

Nav