【问题标题】:how to disable horizontal scroll for a uiwebview?如何禁用 uiwebview 的水平滚动?
【发布时间】:2011-04-15 02:14:26
【问题描述】:

我创建了一个示例,其中我将一个单词(.docx)导入到 uiwebview 并显示。我得到了输出,但我不想显示水平滚动条,垂直滚动也不能正常工作,我可以当我垂直滚动它时,可以看到 webview 后面的黑色空间。 这是我的代码:

#import <UIKit/UIKit.h>

@interface userguideLinesNewViewController : UIViewController {
    IBOutlet UIWebView *webView;
}
@property (nonatomic,retain) UIWebView *webView;
-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webViews;
@end
#import "userguideLinesNewViewController.h"

@implementation userguideLinesNewViewController
@synthesize webView;
-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webViews
{

 NSString *path = [[NSBundle mainBundle] pathForResource:@"BTBP CLARITY SKIN ADVISORuser.docx" ofType:nil];
    NSURL *url = [NSURL fileURLWithPath:path];
 NSURLRequest *request = [NSURLRequest requestWithURL:url];
 [webViews loadRequest:request];
}
- (void)viewDidLoad {
    [super viewDidLoad];
 [self loadDocument:@"BTBP CLARITY SKIN ADVISORuser.docx" inView:self.webView];
}

【问题讨论】:

  • 请设置
     来包装你的代码 ^^

标签: iphone uiwebview scrollview


【解决方案1】:

您可以查看有关此的其他主题:Stop UIWebView from "bouncing" vertically? :-)

没有像 UIScrollView 这样的方法。但是有一些方法可以实现你的目标;-)

这是我的方式。

- (void)disableBounce {

    for(self.subviews 中的 id 子视图)
        if ([[子视图类] isSubclassOfClass: [UIScrollView 类]])
            ((UIScrollView *)subview).bounces = NO;

}

享受...

【讨论】:

    猜你喜欢
    • 2011-01-24
    • 1970-01-01
    • 2012-04-23
    • 1970-01-01
    • 1970-01-01
    • 2010-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多