A light-weight, simple and customizable web browser component for iOS.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 45 commits behind kmikael:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example.xcodeproj
Example
PBSafariActivity
PBWebViewController
LICENSE.txt
PBWebViewController.podspec
README.md

README.md

PBWebViewController

PBWebViewController is a light-weight, simple and customizable web browser component for iOS. It's just 2 source files, image-free, around 300 lines of code and has been built with modern Cocoa development techniques.

PBWebViewController Screenshot

Installation

Just drag the PBWebViewController folder to your project or add pod 'PBWebViewController' to your Podfile.

Usage

PBWebViewController works on iPhone and iPad, in all orientations and is meant to be used in a UINavigationController. All you need to do is set up it's properties and then push it. Here's a simple example:

// Initialize the web view controller and set it's URL
self.webViewController = [[PBWebViewController alloc] init];
self.webViewController.URL = [NSURL URLWithString:@"http://www.apple.com"];

// These are custom UIActivity subclasses that will show up in the UIActivityViewController
// when the action button is clicked
PBSafariActivity *activity = [[PBSafariActivity alloc] init];
self.webViewController.applicationActivities = @[activity];

// This property also corresponds to the same one on UIActivityViewController
// Both properties do not need to be set unless you want custom actions
self.webViewController.excludedActivityTypes = @[UIActivityTypeMail, UIActivityTypeMessage, UIActivityTypePostToWeibo];

// Push it
[self.navigationController pushViewController:self.webViewController animated:YES];

See the example project for more advanced usage.

Subclassing Notes

PBWebViewController can safely be subclassed to implement custom behaveour. Override load and the UIWebViewDelegate methods to hook in, just don't forget to call super to take advantage of what PBWebViewController provides.

A simple subclass is used in the example project.

Notes on custom activity items and application activities

PBWebViewController adds the current URL and any activity items you provide to the application activity that is clicked. You can customize everything that shows up when the action button is clicked this way.

Another way to achieve the same result is to override activityItems and applicationActivities in a subclass.

Check out the action: method in PBWebViewController.m for more details.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request