I'm developing for iOS 6, and I'm working in a way in the toolbar at the top of a UIWebView Which will be reduced as you scroll up on the UIWebView.
My thought is that I can send the UIScrollView UIWebView message to my UIViewController, which is to set the representative of animate the barriers on the toolbar at the top
However, Now, there are many other questions that are similar to this, most of whom forget to set representative property on Scroll Weave ... No need to say, I am setting up a representative. Some code pieces: SDDefinitionViewController.h: SDDefinitionViewController.m: And, to close it, I did some debugger console actions: Therefore, the representative is definitely set correctly, nothing is being released randomly. Finally, I called the program called So, what is the scoop on it? Why scrollview will not call your representative methods Edit: So, looking at my app with, I think my UIWebView is a _UIWebViewScrollView as a subview, And it has a UIWebBrowserView below UIWebBrowserView is exactly the same size as UIWebView ... It may be that UIWebViewScrollView is a normal content that it offset and so on, that webkit scrolls Or is not doing something? After In this way I solved the problem: Click and make sure that your Your scrollViewDidScroll method will now be called in SDDefinitionViewController.m scrollViewDidScroll: does not seem to call the method, which confuses me.
@interface SDDefinitionViewController: UIViewController & LT; UIWebViewDelegate, UIScrollViewDelegate & gt; ...
... - (zero) viewDidload {{Super ViewDoadload}; // Setup an additional after loading the view [self load definitions]; // Hold the context of ScrollView so that we can set the delegate and then use those method calls to animate the top bar. Self.scrollView = self.webView.scrollView; Self.scrollView.delegate = self; Self.lastScrollViewVerticalOffset = 0; } ... - (zero) scrollViewDidScroll: (UIScrollView *) scrollView {// (code) & lt; = Never called ... ...
( Lldb) po $ self 0 $ 0x095c0600 & lt; SDDefinitionViewController: 0x95c0600 & gt; (LLDB) PS self.scrollView $ 1 = 0x0954e8d0 & lt; _UIWebViewScrollView: 0x954e8d0; Frame = (0; 1024 596); Clip Tubons = Yes; Autoresc = h; Inspirator = & lt; NSArray: 0x954ec50 & gt; Layer = & lt; CALayer: 0x954eab0 & gt;; Content Offset: {0, 0} & gt; (LLDB) PS self.scrollView.delegate $ 2 = 0x095c0600 & lt; SDDefinitionViewController: 0x95c0600 & gt;
setContentOffset on
self.scrollView and the representative method but this is actually Is not useful because I have to find out that the user is scrolling with a gesture.
UIWebView internally applies
UIScrollViewDelegate < / Code> Methods It is unlikely that
UIScrollViewDelegate will be re-specified for other objects except the current UIWebView object. So, I got a small job around me. You can apply the
UIScrollViewDelegate methods to UIWebView in that category and do not forget to forward the method to super or other unexpected behavior.
self.webview should be of type
WebView . In SDDefinitionViewController.m
self.webView.mScrollDelegate = self;
No comments:
Post a Comment