Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iOS的UIWebView中进行水平滚动?_Ios_Objective C_Uiscrollview_Uiwebview - Fatal编程技术网

如何在iOS的UIWebView中进行水平滚动?

如何在iOS的UIWebView中进行水平滚动?,ios,objective-c,uiscrollview,uiwebview,Ios,Objective C,Uiscrollview,Uiwebview,我正在UIWebView中加载一个pptx文件,它正在加载,并且垂直滚动,但应该水平滚动。这是我的代码 readWebView=[[UIWebView alloc]initWithFrame:CGRectMake(0,0, [UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height)]; NSString *path=[[NSBundle mainBundle] pathForReso

我正在
UIWebView
中加载一个pptx文件,它正在加载,并且垂直滚动,但应该水平滚动。这是我的代码

readWebView=[[UIWebView alloc]initWithFrame:CGRectMake(0,0, [UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height)];
     NSString *path=[[NSBundle mainBundle] pathForResource:@"MyPPT" ofType:@"pptx"];
      readWebView.scrollView.delegate=self;
        NSURL *url=[NSURL fileURLWithPath:path];
        NSURLRequest *request=[NSURLRequest requestWithURL:url];
        readWebView.scalesPageToFit=YES;
        readWebView.scrollView.showsVerticalScrollIndicator=false;
        readWebView.scrollView.showsHorizontalScrollIndicator=true;
        readWebView.scrollView.scrollEnabled=YES;
        readWebView.autoresizingMask=UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        readWebView.scrollView.pagingEnabled=YES;
     [readWebView loadRequest:request];
    [self.view addSubview:readWebView];

readWebView.scrollView.delegate = self;
[readWebView.scrollView setShowsVerticalScrollIndicator:NO];


-(void)scrollViewDidScroll:(UIScrollView *)scrollVie
{
if (scrollVie.contentOffset.y > 0  ||  scrollVie.contentOffset.y < 0 )
    scrollVie.contentOffset = CGPointMake(scrollVie.contentOffset.x, 0);
}
readWebView.scrollView.delegate=self;
[readWebView.scrollView设置ShowsVerticalScrollIndicator:否];
-(无效)scrollViewDidScroll:(UIScrollView*)scrollVie
{
if(scrollVie.contentOffset.y>0 | | scrollVie.contentOffset.y<0)
scrollVie.contentOffset=CGPointMake(scrollVie.contentOffset.x,0);
}

启用水平滚动和禁用垂直滚动:

myWebView.scrollView.delegate = self;
[myWebView.scrollView setShowsVerticalScrollIndicator:NO];

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.y > 0  ||  scrollView.contentOffset.y < 0 )
        scrollView.contentOffset = CGPointMake(scrollView.contentOffset.x, 0);
}
myWebView.scrollView.delegate = self;
[myWebview.scrollView setShowsHorizontalScrollIndicator:NO];

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.x > 0)
        scrollView.contentOffset = CGPointMake(0, scrollView.contentOffset.y);
}

此代码使禁用滚动视图..添加此代码后没有滚动。您需要什么输出