Code Monkey home page Code Monkey logo

pbwebviewcontroller's Introduction

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 behavior. 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 sets the current URL as the only activity item, if none or provided, otherwise the activity items you provide are used. You can fully 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

pbwebviewcontroller's People

Contributors

guillaumealgis avatar kmikael avatar pierrephi avatar vshah23 avatar wharris avatar wircho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pbwebviewcontroller's Issues

Full Screen feature

Is there any "full screen" available or planed for this component ?
Would be fine to "mimic" native browser for this full screen browser feature

Unloaded web views have black background

When I load up a PBWebViewController, set a url and display it, the toolbar at the bottom looks like it's being drawn over black (or just no content) so the translucency is briefly dark and jarring in a mostly white app. I tried loading about:blank or an empty html page first but still get this effect.

A) is this the case for you as well?
B) if so, can we get the toolbar loaded over white by default?

Hide navigation toolbar feature

Hello,

Sometime we just want to have a webview without any navigation toolbar
For example: showing TOS, or Privacy policy from the net.

It would be nice if we have a boolean value to show / hide the navigation toolbar.

Thank you

Use as browser

I did pod try PBWebViewController and I like it very much.

Do you know of an example project or fork that uses this as a full-fledged browser? E.g. at a minimum having an address bar, preferably with support for multiple windows.

I also tried ghostery/banshee, but it's not as minimal as this project. But I'd like to use it as a browser, rather than just as an embedded web view within another app.

Question on same-origin policy (SOP) across iframes

Does PBWebViewController's webkit implementation allow access to web preferences so that one can disable SOP across iframes that have different origins? Or is it just a view controller built over the standard iOS Webkit library?

No basic authentication support

If a page asks for authentication the control doesn't provide input fields like SFSafariViewController does.

Should be enabled through some properties?

PBSafariActivity not found after Pod Install

Seems that if I install via Pod Install, I get the PBWebViewController but not the PBSafariActivity. Is that normal ?

This is what I'm importing in my code:

import "PBWebViewController/PBWebViewController.h"

I couldn't find any trace of PBSafariActivity so will try and install it manually. Just thought it should come with the pod.

Let me know if you think I'm doing something stupid.

Thanks.

On page load delegate method

Right now there is no onload callback in place, would be a nice feature to have, I will try to fork and might add the feature.
Thanks.

Podspec limited only for iOS7

Hi,

the source code works under iOS6 but the pod spec needs iOS7 to be set.

So for iOS6 the pod can't be used.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.