NSView + NSScrollView, not scrolling
NSView + NSScrollView, not scrolling
- Subject: NSView + NSScrollView, not scrolling
- From: qvacua <email@hidden>
- Date: Sat, 05 May 2012 09:31:03 +0200
I have got a very basic question about NSScrollView. I embedded my
custom NSView into an NSScrollView using Xcode's "Embed In..." menu
item. The following is my custom NSView:
@implementation MyView
- (void)drawRect:(NSRect)dirtyRect {
[[NSColor yellowColor] set];
NSRectFill([self frame]);
}
- (void)keyDown:(NSEvent *)theEvent {
unichar key = [[theEvent characters] characterAtIndex:0];
NSLog(@"\\U%X pressed", (int)key);
[self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
}
- (BOOL)acceptsFirstResponder {
return YES;
}
@end
In "applicationDidFinishLaunching:" I set the frame size of the view
to something big using setFrameSize.
What I want — but now working — is scrolling via Page Up/Down key. If
I understand the doc correctly, I just have to call
"interpretKeyEvents:" like above and since MyView does not respond to
appropriate messages, the responder chain will forward the messages to
the scroll view. However, it does not scroll. What am I missing?
Thanks in advance.
Tae
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden