无法禁用滚动,但保留PDF中的链接和按钮



希望在PDF中禁用滚动,但保留PDF中的链接和按钮。我试过其他线程的解决方案如下,但没有一个适合我:

webView.scrollView.scrollEnabled = NO; 
webView.scrollView.bounces = NO;

,

[[_Presentation scrollView] setScrollEnabled:NO];
[[_Presentation scrollView] setBounces:NO];

[(UIScrollView *)[[_Presentation subviews] lastObject] setScrollEnabled:NO];
[(UIScrollView *)[[_Presentation subviews] lastObject] setBounces:NO];

我终于解决了这个问题。步骤如下:

在。h文件中添加UIScrollViewDelegate:

@interface ViewController : UIViewController  <UIScrollViewDelegate>

在.m文件中,ViewController -> viewDidLoad添加以下行来接管ScrollView Delegate

_Presentation.scrollView.delegate = self;

在.m文件中,在viewDidLoad下面添加以下滚动事件:

-(void)scrollViewDidScroll:(UIScrollView *)scrollView {   
[[_Presentation scrollView] setScrollEnabled:NO];
[[_Presentation scrollView] setBounces:NO];}

最新更新