开发者

How do I increase the width of an NSScroller in a WebView

I am developing a web browser for a开发者_如何学Python touch-screen kiosk and the scrollbars on the WebView are impractically small for being able to scroll using them on a touch-screen. Is there anyway to increase the size of them?

I can get a reference to the vertical scroller using

[[[[[webView mainFrame] frameView] documentView] enclosingScrollView] verticalScroller]


So it turns out you can use categories to override the scroller width method for all NSScrollers.

Eg. In NSScroller-MyScroller.h:

#import <Cocoa/Cocoa.h>

@interface NSScroller (MyScroller)

+ (CGFloat)scrollerWidth;
+ (CGFloat)scrollerWidthForControlSize: (NSControlSize)controlSize;

@end

In NSScroller-MyScroller.m:

#import "NSScroller-MyScroller.h"
#define SCROLLER_WIDTH 30.0

@implementation NSScroller (MyScroller)

+ (CGFloat)scrollerWidth {
    return SCROLLER_WIDTH;
}

+ (CGFloat)scrollerWidthForControlSize: (NSControlSize)controlSize {
    return SCROLLER_WIDTH;
}

@end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜