Claus Broch
Claus Broch

Reputation: 9212

Subclassing IASKAppSettingsViewController

I'm trying to tweak the behavior of the default IASKAppSettingsViewController so it can provide custom subviewcontrollers (as for type = PSChildPaneSpecifier) for custom views (type = IASKCustomViewSpecifier).

I've tried to subclass IASKAppSettingsViewController without adding any new functionality to the code.

However when I load up my own subclass the settings view is completely empty - even for a bare subclass. When I switch back to the default IASKAppSettingsViewController everything works again as expected.

I've tried setting breakpoints various places in my subclass and everything seems to be working fine - except that nothing is displayed.

I've tried looking for clues in the documentation, but can't seem to find anything that explains why. The documentation for InAppSettingsKit even states that it's designed for subclassing.

What am I missing here? Any clues are appreciated - or even better a small step-by-step guide for dummies.

Updated with code:

Setting up the flipside view. It works with the standard IASKAppSettingsViewController but fails with my empty derived MyCustomSettingsViewController

- (IBAction)showInfo:(id)sender
{    
    // Setup navigation controller for settings view
    MyCustomSettingsViewController *settings = [[MyCustomSettingsViewController alloc] init];
    //IASKAppSettingsViewController *settings = [[IASKAppSettingsViewController alloc] init];
    settings.delegate = self;
    settings.showDoneButton = YES;
    UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:settings];
    navigation.navigationBar.barStyle = UIBarStyleBlack;
    [settings release];

    // Display the settings
    navigation.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:navigation animated:YES];
    [navigation release];
}

Upvotes: 1

Views: 864

Answers (2)

Ortwin Gentz
Ortwin Gentz

Reputation: 54151

Try to add this method to your subclass:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    return [super initWithNibName:@"IASKAppSettingsView" bundle:nibBundleOrNil];
}

If you don't do that, the default implementation of IASKAppSettingsViewController kicks in and it tries to find a nib named after your class name, in this case "MyCustomSettingsViewController.nib". This probably doesn't exist.

This happens because the default implementation of -init calls -initWithNibName:nil bundle:nil and nil as the filename means to search for a default nib.

Upvotes: 1

Rahul Vyas
Rahul Vyas

Reputation: 28730

Try setting breakpoint on initialization steps and if you are adding that as a subview/ pushing on navigation controller. Use NSLogs for each method so you can find the issue. If nothing works send me the code (create a demo code using IASKAppSettingsViewController) to recerate the problem then I'll look into the issue.

Upvotes: 0

Related Questions