Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS UIScrollView setScrollEnabled fails

In iOS5 this works fine:

[descriptionWebView.scrollView setScrollEnabled:NO];

But in any iOS under 5 it fails with:

[UIWebView scrollView]: unrecognized selector sent to instance 0x791f9e0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWebView scrollView]: unrecognized selector sent to instance 0x791f9e0'
like image 801
Jesse Avatar asked Jan 18 '26 03:01

Jesse


1 Answers

The issue isn't the setScrollEnabled: call. It's actually that the scrollView of the UIWebView wasn't exposed until iOS 5 (which is why it fails on anything else). See the UIWebView documentation for further information.

In previous versions of iOS, you had to resort to iterating through the subviews of your UIWebView to find a UIScrollView.

like image 84
Ryan Wersal Avatar answered Jan 19 '26 18:01

Ryan Wersal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!