Before ios5 I was able to access a UIWebView's UIScrollView delegate like this:
for (id subview in webView1.subviews){
if ([[subview class] isSubclassOfClass: [UIScrollView class]]) {
UIScrollView * s = (UIScrollView*)subview;
OldDelegate = s.delegate;//OldDelegate is type id
s.delegate = self;
}
}
Now, I know that's not the right way to do it, but at the time (as far as I understood) it was the only way to do it. iOS 5 has changed that, so I am trying to do it the iOS 5 way:
UIScrollView * s = webView.scrollView;
Olddelegate = s.delegate;
s.delegate = self;
But either way I try to do it, the value of my OldDelegate object is 0x0. It is really important that I retain this delegate value, but try as I might, I'm just getting 0x0.
Any ideas?
I'm not using ARC...
The scrollView
property of UIWebView
is a subclass of UIScrollView
. This private class, called _UIWebViewScrollView
does not use the delegate
property, it is always nil. Maybe you could do some refactoring and get the real scrollview-delegate, but i'm almost 100% sure apple will reject your app doing so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With