Bad*_*ate 6 cocoa scroll webview
我加载了webview并将allowsScrolling设置为NO,但是webview仍然显示滚动条...现在MacBooks有锋利的金属边缘,在你的计算机上敲打你的头很多.
我的代码:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
NSString *webFolder = @"file:///<WebFolderPath>";
[[[productWeb mainFrame] frameView] setAllowsScrolling:NO];
[productWeb setFrameLoadDelegate:self];
[[productWeb mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[webFolder stringByAppendingString:@"webpage.html"]]]];
}
Run Code Online (Sandbox Code Playgroud)
我甚至设置帧加载委托来报告滚动状态:
- (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");
}
Run Code Online (Sandbox Code Playgroud)
这仍然让我不快乐:
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
Run Code Online (Sandbox Code Playgroud)
然而滚动条继续显示!希望这是我做的蠢事,因为我不想在我的笔记本电脑上得到更多的血.
我发现我必须编辑我试图显示的页面的 HTML,以确保它设置为全屏(而不是更多)...有一个 DIV 设置了最小宽度。一旦我确保主体的高度 = 100%,并且没有一个 DIV 具有固定或最小宽度设置,该宽度设置小于我想要在所有内容中显示的框:)
| 归档时间: |
|
| 查看次数: |
2591 次 |
| 最近记录: |