summaryrefslogtreecommitdiff
path: root/UICaboodle
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-23 02:49:30 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-02-23 02:49:30 -0800
commit8e3b68d4629fe84dd0cb0ee08c45d1037e8a0d3a (patch)
tree644080d512e61f03bad93ed5a404a6a628e50c7d /UICaboodle
parented5566c758424fffb2204d93d93998d7fbc744b6 (diff)
Add cydia.scrollToBottom().
Diffstat (limited to 'UICaboodle')
-rw-r--r--UICaboodle/BrowserView.mm11
1 files changed, 11 insertions, 0 deletions
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index 07a92ee..d5116cf 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -601,6 +601,17 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
closer_ = [function retain];
}
+- (void) scrollToBottomAnimated:(NSNumber *)animated {
+ CGSize size([scroller_ contentSize]);
+ CGPoint offset([scroller_ contentOffset]);
+ CGRect frame([scroller_ frame]);
+
+ if (size.height - offset.y < frame.size.height + 20.f) {
+ CGRect rect = {{0, size.height-1}, {size.width, 1}};
+ [scroller_ scrollRectToVisible:rect animated:[animated boolValue]];
+ }
+}
+
- (void) _setViewportWidth {
[[webview_ _documentView] setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
}