2014-03-30 41 views

回答

2

經過多次打擊之後,我想出了答案。關鍵是獲取WebView創建的滾動視圖的句柄(但不公開公開)。以下是如何操作:

- (void)awakeFromNib 
{ 
    [self setMainFrameURL:@"http://www.stackoverflow.com"]; 
    NSScrollView * scrollView = (NSScrollView *)([[[self mainFrame] frameView] subviews][0]); 
    [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic]; 
    [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic]; 
} 

請注意,只要設置了框架的URL,就需要完成此操作。

+2

你應該使用'frameView.documentView.enclosingScrollView'。看到類似的答案http://stackoverflow.com/a/11820479/199607 –

相關問題