Skip to content
Browse files

WebView will now maintain its text size (zoom level) between launches

  • Loading branch information...
1 parent 8429532 commit 52f83a9b9d569c7783c70cff92daefe562e2b705 @Kapeli committed
Showing with 24 additions and 2 deletions.
  1. +21 −0 HighlightedWebView/DHWebView.m
  2. +3 −2 README.md
View
21 HighlightedWebView/DHWebView.m
@@ -486,6 +486,27 @@ - (void)didStartProvisionalLoad
self.entirePageContent = [NSMutableString string];
}
+- (void)makeTextLarger:(id)sender
+{
+ [super makeTextLarger:sender];
+ [[NSUserDefaults standardUserDefaults] setFloat:[self textSizeMultiplier] forKey:@"DHHighlightedWebViewTextSizeMultiplier"];
+}
+
+- (void)makeTextSmaller:(id)sender
+{
+ [super makeTextSmaller:sender];
+ [[NSUserDefaults standardUserDefaults] setFloat:[self textSizeMultiplier] forKey:@"DHHighlightedWebViewTextSizeMultiplier"];
+}
+
+- (void)awakeFromNib
+{
+ float textSizeMultiplier = [[NSUserDefaults standardUserDefaults] floatForKey:@"DHHighlightedWebViewTextSizeMultiplier"];
+ if(textSizeMultiplier > 0)
+ {
+ [self setTextSizeMultiplier:textSizeMultiplier];
+ }
+}
+
- (void)dealloc
{
[self invalidateTimers];
View
5 README.md
@@ -7,8 +7,9 @@ Drop-in WebView subclass that adds Safari-style in-page search-result highlighti
Features:
=========
-* Highlight search results (Safari-style).
-* Show position of search results by highlighting the scrollbar (Google Chrome-style).
+* Highlight search results.
+* Show position of search results by highlighting the scrollbar.
+* Maintain text size (zoom level) between launches.
Project Goals:
==============

0 comments on commit 52f83a9

Please sign in to comment.
Something went wrong with that request. Please try again.