IconCollection/AAPLMyWindowController.m

/*
 Copyright (C) 2015 Apple Inc. All Rights Reserved.
 See LICENSE.txt for this sample’s licensing information
 
 Abstract:
 This sample's main window controller object.
 */
 
#import "AAPLMyWindowController.h"
#import "AAPLMyViewController.h"
 
@interface AAPLMyWindowController ()
 
@property (strong) AAPLMyViewController *viewController;
@property (weak) IBOutlet NSView *myTargetView;
@property (weak) IBOutlet NSTextField *selectionField;
 
@end
 
 
#pragma mark -
 
@implementation AAPLMyWindowController
 
// -------------------------------------------------------------------------------
//  awakeFromNib
// -------------------------------------------------------------------------------
- (void)awakeFromNib
{
    [[self window] setAutorecalculatesContentBorderThickness:YES forEdge:NSMinYEdge];
    [[self window] setContentBorderThickness:30 forEdge:NSMinYEdge];
    
    // load our nib that contains the collection view
    [self willChangeValueForKey:@"viewController"];
    _viewController = [[AAPLMyViewController alloc] initWithNibName:@"Collection" bundle:nil];
    [self didChangeValueForKey:@"viewController"];
    
    [self.myTargetView addSubview:self.viewController.view];
    
    // make sure we resize the viewController's view to match its super view
    [self.viewController.view setFrame:[self.myTargetView bounds]];
    
    [self.viewController setSortingMode:0];     // ascending sort order
    [self.viewController setAlternateColors:NO];    // no alternate background colors (initially use gradient background)
}
 
@end