So I wrote a pretty cool addition to DMAFWebViewController.
If you set webViewController.webView.footerView to a UIView, the view will be placed inside the webView's scroll view below all the web content. If the web content changes size (because a page loads) the footer will be pushed below the web content.
I think this may be a novel way of doing this. Googling around for a way to add a footer to UIWebView I found UIWebView with Header and Footer which uses javascript calls to ask the webview how large its content is.
I also used objc_setAssociatedObject to store the content size. You need to remember the last contentSize because you need to adjust the contentSize in order to make room for the footer. You'd get infinite recursion if you didn't watch for this. The reality is I could easily have used a property to do this, I was just keen to try out the whole associatedObject thing.
The above linked commit details all the changes needed to make this happen.
EDIT: Pages that are shorter than the UIWebView's frame don't trigger a contentSize change. Adding this to layoutSubviews fixes the issue by triggering one manually the first time layoutSubviews is called:
if (!objc_getAssociatedObject(self.scrollView, "associated_height")) { NSValue *value = [NSValue valueWithCGSize:self.scrollView.contentSize]; [self observeValueForKeyPath:@"contentSize" ofObject:self.scrollView change:@{NSKeyValueChangeNewKey : value} context:nil]; }
See this commit for the change in action.












