为什么uiwebview不显示水平滚动条?

时间:2013-01-11 12:10:56

标签: iphone uiwebview horizontal-scrolling

我在iphone视图中放置了一个uiwebview,其框架为0,0,320,460。 我用loadHTMLString加载uiwebview。 有时我会从网上获得“table width = 800 ...”字符串。 如果uiwebview的内容比其框架宽,我想自动显示uiwebview的水平滚动条。

//webview
        newsWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
        newsWebView.delegate=self;
        newsWebView.backgroundColor=[UIColor clearColor];
        newsWebView.opaque=NO;
        newsWebView.scrollView.scrollEnabled=YES;
        [newsWebView.scrollView setShowsHorizontalScrollIndicator:YES];
        [newsWebView.scrollView setAlwaysBounceHorizontal:YES];
        newsWebView.userInteractionEnabled=YES;

我用以下代码加载字符串:

NSString *sHTML = [NSString stringWithFormat:@"<html> \n"
                               "<head> \n"
                               "<style type=\"text/css\"> \n"
                               "body {font-family: \"%@\"; font-size: %@; -webkit-user-select:none;}\n"
                               "</style> \n"
                               "</head> \n"
                               "<body>%@</body> \n"
                               "</html>", DEFAULT_FONT_NAME, [NSNumber numberWithInt:webViewFontsize], body];

我应该设置什么属性或者我应该使用css?

0 个答案:

没有答案
相关问题