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
精彩评论