NSScrollView isFlipped question
If I am programmatically creating an NSScrollView how do I go about flipping it? For example:
//set up the page rect
displayPageRect=NSMakeRect(400.0, 40.0,pageWidth, pageHeight);
displayPage = [[NSScrollView alloc] initWithFrame:displayPageRect];
How do I then over ride the default isFlipped setting from NO to YES?
Tried [displayPage isFlipped: YES]; and got a warning that displayPage d开发者_JAVA技巧idn't recognize the method and then the app failed on run.
You can subclass NSView to take flipped view.
@interface FlippedView : NSView {
}
@end
@implementation FlippedView
- (BOOL) isFlipped
{
return YES;
}
@end
Than set your flipped view as documentView of NSScrollView.
NSScrollView *scrollView = [[NSScrollView alloc] initWithFrame:frame];
FlippedView *flippedView = [[FlippedView alloc] initWithFrame:frame];
[scrollView setDocumentView: flippedView];
精彩评论