Big Nerd Ranch Day 3
Wow. Now *that* was the most geeky stuff I've ingested in *any* 24 hour period. period.
Today's topics:
- Custom Views
- Quartz graphics / Image Manipulation
- Notification Centers
- Localization
- Capturing user events (mouse/keyboard)
- CoreData
And (!) we got to meet Rocco Bowling who was (is?) an OpenGL (no kidding) programmer for the NSA. He'll be teaching the openGL bootcamp. His stuff (games and other apps) is incredible. The man actually uses openGL to make cocoa widgets. Yes. The force is strong in this one and he's around my age. Damn, I have to stop switching careers.
I went for a run in the heat and humidity this afternoon instead of going on the Big Nerd afternoon walk. I could barely breathe, that is until it started to sprinkle pleasantly. Then, as is apparently typical of Georgia weather, it poured... pleasantly. Sort of. I spent the last portion of the run much cooler (and breathing well), but I also spent it with my shirt wrapped around my upper arm to protect my iPod from the drench. I doubt that it survives the float test, but we nearly got there today, my Ipod and I. Note to self: remember how rejuvinating a short workout can be. I finished the day with great mental clarity.
I promised observations on Southern Hospitality. Here's one: it's real. Everyone is as friendly as the wonderful folks where I was brought up (Minnesota / Iowa) without that sometimes insidious "you're not from around here so I'm not sure I like you" vibe. And they're feeding me like my Grandma tries to feed me. Tomorrow, I'll tell y'all about the food.
Notes from yesterday and today are posted below.
Sorting a NSTableView:
See pg 132-134 on how to select (or implement) a comparison method
UNDO!:
iThermostat.app is an example
*NOTE: Undo / REdo stack is, by default, grouped per action. If hitting a
button puts 15 things on the undo stack, those 15 undo actions are called
when hitting undo.
TEXTVIEWS!:
Undo is automatic iff you set undo allowed in the attributes inspector
Hillegass p. 150
NSArrayController:
TURN OFF the Preserves selection!!!!!!!!!!!!!!! box
NSCoder (read/write obj to disk)
**The advanced book has DO (Distributed Objects) !!**
See Chapter 8 for simple serialized-to-disk doc files.
Multiple Nibs:
**See the extra chapters in the handout book on view swapping**
Make things that won't necessarily appear on the screen not load until
they're needed.
Good for things like preferences
User Defaults (NSUserDefaults):
There is a controller for this = sharedDefaultsController
CoreData:
weeeee!
See the app with coredata on it
--------------------------------------------------------------------------------------------
Custom Views (OvalView.app, Hillegass chp. 14):
in IB
Subclass NSView
Make Files
Drag Custom View (say, OvalView)
Make Custom Class of Custom View in inspector point to OvalView
NSView Methods covered
drawRect (within custom view boundaries)
mouseDown (event within the window's boundaries)
mouseDragged (event within the window's boundaries)
Add printing (Quartz 2D)
Just connect the print menu to the custom view's print action
IB Tricks:
Option-Drag most anything in IB and you make a matrix of (say) buttons
Layout:
Make subview of... lets you make something an inner view
of something else
(Aside)
Quartz Debug (performance tool)
Tools:
Show user interface resolution (change to say 1.5)
Allows you to check your application for resolution independence
(end Aside)
NSRect:
Origin: NSPoint
NSRect: width, height
NSBezierPath:
Draws lines, rectangles, curves (<--the usual Bezier)
Toys:
TO change Scale of an image (There are other toys in a file on the Dav server):
- (IBAction)changeScale:(id)sender
{
float scale = (float)[[sended selectedItem] tag] / 100.0;
NSLog(@"new scale = %f", scale);
NSClipView *cv = [[stretchView enclosinScrollView] contentView];
NSSize unscaledSize = [cv frame].size;
NSSize scaledSize;
scaledSize.height = unscaledSize.height / scale;
scaledSize.width = unscaledSize.width / scale;
[cv setboundsSize:scaledSize]
}
NSImage
holds imageReps of various kinds (image representations)
Notification Centers:
NSNotification center as per usual
Post to the center
Observe an object
Observer is notified when my object posts
Observers are not retained by the notification center
- SO! we have to remove an object from any Notifying objs for which
it is registered on in it's own dealloc method.
- in Objc 2.0, garbage collector automatically removes me from objc
on collection
Delegates are automatically registered
Localization:
Ick - It's hard
Keyboard Events
(AM will like this)
Chp 16 - Catch the keyboard input
BigBang Chess from freeverse - Check it out. The guy who wrote it is
doing an OpenGL bootcamp in (november?)
MORE COREDATA!
//to see the SQL getting executed, do this
class privateClass;
privateClass = NSClassFromString(@"NSSQLConnection");
[privateClass setDebugDefault:YES];
Comments
La localisation n'est pas difficile si vous ne vous occupez pas des dossiers multiples de "nib".
Posted by: Two rows back, 2 seats over | August 23, 2006 09:29 PM
Yeah... probably should have written "tedious..." But, then again, doesn't *everybody* speak English?
No?
Shocking!
Posted by: jonathan | August 24, 2006 11:09 AM