Mark Khor
Mark Khor

Reputation: 414

WebView Unable to disable scroll, yet retain links and button in PDF

Would like to disable scrolling in PDF but retain links and button in PDF. Had tried other threads' solutions as follow, but none of it work for me:

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

Neither,

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

Nor,

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

Upvotes: 1

Views: 116

Answers (1)

Mark Khor
Mark Khor

Reputation: 414

I finally solve this issue. Here is the steps:

Add UIScrollViewDelegate in the .h file:

@interface ViewController : UIViewController  <UIScrollViewDelegate>

In .m file, ViewController -> viewDidLoad add following line to take over ScrollView Delegate

_Presentation.scrollView.delegate = self;

In .m file, add following scroll event below viewDidLoad:

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

Upvotes: 1

Related Questions