Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 didn't recognize the method and then the app failed on run.

like image 213
PruitIgoe Avatar asked Feb 16 '26 12:02

PruitIgoe


1 Answers

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];
like image 96
Dima Portenko Avatar answered Feb 19 '26 04:02

Dima Portenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!