我加载了webview并将allowsScrolling设置为NO,但是webview仍然显示滚动条...现在MacBooks有锋利的金属边缘,在你的计算机上敲打你的头很多.
我的代码:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application NSString *webFolder = @"file:///"; [[[productWeb mainFrame] frameView] setAllowsScrolling:NO]; [productWeb setFrameLoadDelegate:self]; [[productWeb mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[webFolder stringByAppendingString:@"webpage.html"]]]]; }
我甚至设置帧加载委托来报告滚动状态:
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { NSLog(@"Scrolling %@",[[frame frameView] allowsScrolling] ? @"Allowed" : @"Not Allowed"); [[frame frameView] setAllowsScrolling:NO]; NSLog(@"Scrolling %@",[[frame frameView] allowsScrolling] ? @"Allowed" : @"Not Allowed"); }
这仍然让我不快乐:
2010-08-24 15:20:09.102 myApp[30437:a0f] Scrolling Allowed 2010-08-24 15:20:09.104 myApp[30437:a0f] Scrolling Not Allowed
然而滚动条继续显示!希望这是我做的蠢事,因为我不想在我的笔记本电脑上得到更多的血.