如何禁用uiwebview的水平滚动? [英] how to disable horizontal scroll for a uiwebview?
本文介绍了如何禁用uiwebview的水平滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个示例,在其中将单词(.docx)导入到uiwebview并显示.我得到了输出,但是我不想显示水平滚动条,垂直滚动也无法正常工作,我可以当我垂直滚动时,看到webview后面的黑色空间.这是我的代码:
I created a sample in which i imported a word(.docx)on to the uiwebview and displayed.I got the output but i don't want to display the horizontal scroll bar and the vertical scroll also working not properly i can see the black space behind the webview when i scroll it vertically. Here is my code:
#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];
}
推荐答案
您可以查看与此有关的其他主题:停止UIWebView的弹跳"垂直吗? :-)
You could check others topics about this : Stop UIWebView from "bouncing" vertically? :-)
没有类似UIScrollView的方法.但是有某种方式可以实现您的目标;-)
There isn't a method like in UIScrollView. But there is some kind of way to achieve your goal ;-)
这是我的方式.
- (void)disableBounce {
for (id subview in self.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).bounces = NO;
}
享受...
这篇关于如何禁用uiwebview的水平滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文