NSScrollView
NSScrollView
- Subject: NSScrollView
- From: Matthew Cox <email@hidden>
- Date: Sat, 13 Oct 2001 14:47:22 -0400
What is the correct way to use an NSScrollView? My understanding (and
logical analysis) seems to deduce:
1: NSScrollView is placed in window, and linked to controller outlet (as
a NIB file)
@interface
{
IBOutlet NSScrollView *scroller;
ArbitraryNSViewSubclass *view;
}
//__ Misc protoypes
@end
2: In awakeFromNib (or someplace similar)
{
//Prepare everything that view will need to draw (tilemap, etc.)
view = [[ArbitraryNSViewSubclass alloc] init];
[scroller setDocumentView:view];
//Clean up init. DON'T RELEASE view, NEEDED FOR FUTURE CONTROLLER TASKS
}
Events are handled in this fashion:
1 NSScrollView takes all events, performs any applicable to itself:
Scrolling, resizing, etc.
2 ArbitraryNSViewSubclass gets all events that occur in the drawn area,
such as mousedown, or any that do not apply NSScrollView (like 'k'
pressed).
This about close to reality?