Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:shpakovski/MASPreferences

  • Loading branch information...
commit d5aa8ae0727fee510f22519e4fd9822db0e9ba90 2 parents caa0fcc + 29bfb27
@shpakovski authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 MASPreferencesWindowController.m
View
11 MASPreferencesWindowController.m
@@ -1,4 +1,3 @@
-
#import "MASPreferencesWindowController.h"
NSString *const kMASPreferencesWindowControllerDidChangeViewNotification = @"MASPreferencesWindowControllerDidChangeViewNotification";
@@ -67,7 +66,7 @@ - (void)windowDidLoad
[[self window] setTitle:self.title];
if ([self.viewControllers count])
- self.selectedViewController = [self viewControllerForIdentifier:[[NSUserDefaults standardUserDefaults] stringForKey:kMASPreferencesSelectedViewKey]] ?: [self.viewControllers objectAtIndex:0];
+ self.selectedViewController = [self viewControllerForIdentifier:[[NSUserDefaults standardUserDefaults] stringForKey:kMASPreferencesSelectedViewKey]] ?: [self firstViewController];
NSString *origin = [[NSUserDefaults standardUserDefaults] stringForKey:kMASPreferencesFrameTopLeftKey];
if (origin)
@@ -77,6 +76,14 @@ - (void)windowDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:self.window];
}
+- (NSViewController <MASPreferencesViewController> *)firstViewController {
+ for (id viewController in self.viewControllers)
+ if ([viewController isKindOfClass:[NSViewController class]])
+ return viewController;
+
+ return nil;
+}
+
#pragma mark -
#pragma mark NSWindowDelegate
Please sign in to comment.
Something went wrong with that request. Please try again.