Big Nerd Ranch Day 4
For now... just the notes. It's the last *full* day of BNR and Aaron says that we "look full." You don't know the half of it, man.
Nil Targeted menu items:
WIndow can be key window, but not main window if you want
(For example we wouldn't want to print a pallete, but we might want to
type in it.)
First Responder in IB is actually the nil target
Make a new menu item
Make an action in 1st responder corresponding to the menu item
Connect the menu item to first responder (make your own action in 1st responder)
NSPasteboard:
System-wide copy/paste
Categories:
Add methods to an existing class
Declare a category for NSString called FirstLetter
#import
@interface NSString (FirstLetter)
- (NSString *)firstLetter;
@end
#import "FirstLetter.h"
@implementation NSString (FirstLetter)
- (NSString *)firstLetter
{
... etc.
}
//Informal protocols (Declaring unimplemented methods...):
@interface NSWindow : NSResponder
---
@end@interface NSObject (NSWindowDelegate)
- (BOOL)windowShouldClose:(id)sender;
- (id)windowWillReturnFieldEditor:(NSWindow *)sender
toObject:(id)client;
...
@end
In objc 2.0, there will be @optional
Drag 'n Drop:
Define view as a drag source
Define view as a drag dest.
Quite a few methods to implement to be a dest.
Drawers:
BUtton on window
Drag an NSDrawer to instances
Drawer needs to know:
parent window (IBOutlet)
Ctrl-drag from button to drawer
Choose toggle
Drop Custom View into instances
Ctrl-drag from drawer to view
choose content view
Printing:
Basically rectangles overlaid on a view. Print each rectangle...
More specifically, something kinda tedious, but not complicated.
Deeper understanding of bindings:
Here's how they work...
(We built an obj that is "bindable" and connected it to something)