开发者

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜