Permalink
Browse files

Added UIWebView category

  • Loading branch information...
1 parent fa75f6e commit 8c6d80e2b17fcf42fcd442e4b001e0b50e58fadb @odrobnik odrobnik committed May 28, 2012
Showing with 42 additions and 0 deletions.
  1. +21 −0 Core/Source/UIWebView+DTFoundation.h
  2. +21 −0 Core/Source/UIWebView+DTFoundation.m
@@ -0,0 +1,21 @@
+//
+// UIWebView+DTFoundation.h
+// DTFoundation
+//
+// Created by Oliver Drobnik on 25.05.12.
+// Copyright (c) 2012 Cocoanetics. All rights reserved.
+//
+
+/**
+ Some convenient functions that can be also achieved if you know JavaScript, but are way more easy to remember like this
+ */
+
+@interface UIWebView (DTFoundation)
+
+/**
+ Getting the current document's title
+ @returns A string with the document title
+ */
+- (NSString *)documentTitle;
+
+@end
@@ -0,0 +1,21 @@
+//
+// UIWebView+DTFoundation.m
+// DTFoundation
+//
+// Created by Oliver Drobnik on 25.05.12.
+// Copyright (c) 2012 Cocoanetics. All rights reserved.
+//
+
+#import "UIWebView+DTFoundation.h"
+
+// force this category to be loaded by linker
+MAKE_CATEGORIES_LOADABLE(UIWebView_DTFoundation);
+
+@implementation UIWebView (DTFoundation)
+
+- (NSString *)documentTitle
+{
+ return [self stringByEvaluatingJavaScriptFromString:@"document.title"];
+}
+
+@end

0 comments on commit 8c6d80e

Please sign in to comment.