haaakon

4pods

Gamify

An easy way of adding some basic gamification elements to your app.

License: MIT

  • Objective C

UISearchBar-Blocks

Adds blocks to all UISearchBar delegate methods with a category, no subclassing. Also allows the use of delegate methods if no block is set.

License: MIT

  • Objective C

UITextField-Blocks

Adds blocks to all UITextField delegate methods with a category, no subclassing. Also allows the use of delegate methods if no block is set.

License: MIT

  • Objective C

UIWebView-Blocks

UIWebView-Blocks ================

UIWebView+Blocks is A simple category that implements blocks into UIWebView. This allows you to use the power of blocks instead of implementing a delegate.

USAGE FOR NSURLRequests


Instead of allocating a new UIWebView and assigning a delegate, just call one of the static methods:

objc UIWebView *webView = [UIWebView loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"http://google.com"]] loaded:^(UIWebView *webView) { NSLog(@"Loaded successfully"); } failed:^(UIWebView *webView, NSError *error) { NSLog(@"Failed loading %@", error); }];

OR

objc UIWebView *webView = [UIWebView loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"http://google.com"]] loaded:^(UIWebView *webView) { NSLog(@"Loaded successfully"); } failed:^(UIWebView *webView, NSError *error) { NSLog(@"Failed loading %@", error); } loadStarted:^(UIWebView *webView) { NSLog(@"Started loading %@", webView.request.URL.absoluteString); } shouldLoad:^BOOL(UIWebView *webView, UIWebViewNavigationType navigationType) { return YES; }];

USAGE FOR HTML Strings


objc UIWebView *webView = [UIWebView loadHTMLString:htmlString loaded:^(UIWebView *) { NSLog(@"Loaded successfully"); } failed:^(UIWebView *, NSError *) { NSLog(@"Failed loading %@", error); }];

OR

objc UIWebView *webView = [UIWebView loadHTMLString:htmlString loaded:^(UIWebView *) { NSLog(@"Loaded successfully"); } failed:^(UIWebView *, NSError *) { NSLog(@"Failed loading %@", error); } loadStarted:^(UIWebView *webView) { NSLog(@"Started loading %@", webView.request.URL.absoluteString); } shouldLoad:^BOOL(UIWebView *webView, NSURLRequest *request, UIWebViewNavigationType navigationType) { return YES; }];

The class will return the UIWebView object which you can later add as a subview to your current view.

objc webView.frame = [[UIScreen mainScreen] bounds]; [self.view addSubview: webView];

Note: UIWebView+Blocks currently doesn't support the simultaneous usage of multiple UIWebViews in the same view.

TRUE ENDING REPORTING


In UIWebView+Blocks.h, set TRUE_END_REPORT to YES if you wish to get notified only when the page is fully loaded instead of being notified every time a resource is loaded (default UIWebViewDelegate behavior). This feature is still under beta and might not work perfectly at all times.

License: MIT

  • Objective C