Giter Club home page Giter Club logo

dznwebviewcontroller's People

Contributors

barbosa avatar bonebox avatar dzenbot avatar github641 avatar guillaumealgis avatar haoyuexing avatar hesyifei avatar insanj avatar liyoro avatar nolanw avatar orta avatar oskarl avatar readmecritic 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  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

dznwebviewcontroller's Issues

how to play video in website

I can't play video in website when I use DZNWebVideoController,but safari can play .I don't know what's wrong

snip20170220_1

Search Field in navigation bar

Hi,
This project helped me a lot and thanks to you, but i am having some problem while i tried to add a textfield as navigation title view when i touched textfield it being animated and textfield hide. Is there any solution for that? If someone solved it please share the code or any link that can help me.

Thanks

Unwinding from DZNWVC to other view

I pushed DZNWVC from existing UINavigationController, it works fine. But when tapping the back button on NavigationView, the app crashed. Looking at the call stack, it seems that the WKScrollView's delegate (which is DZNWVC) is deallocated prematurely. Please fix this?
image
image

WebView Problem

Hi,
I have a problem that can't solve, i need to resize Webview height but can't fix this problem. i can set height but when scroll it resize automatically. Can you help me?

Initial View Controller

Suppose if i want to use this as a initial view controller, how do i pass a url once view is loaded?

Question on same-origin policy (SOP) across iframes

Does DZNWebViewController'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?

Can't install DZNWebViewController v3 via Pod

I want install DZNWebViewController v3 via Pod. For this I use - pod 'DZNWebViewController', '~> 3.1' and I get the result:

[!] Unable to satisfy the following requirements:

  • DZNWebViewController (= 3.1) required by Podfile
    Specs satisfying the DZNWebViewController (= 3.1) dependency were found, but they required a higher minimum deployment target.

If I use pod 'DZNWebViewController', than it installs v2.

Please update podspec

Hi @dzenbot ,
I am using "DZNWebViewController" via CocoaPods, but it is integrating V3.0 source code.
As i can see in your repository, there are some major changes / bug fixes after V3.0, so i am not able to use up-to-date source code via CocoaPods. So please update podspec.

Turbolinks not enabling back/forward buttons

Does DZNWebViewController not allow navigation for turbolinks? The back and forward buttons are not enabled appropriately when navigating a website that uses turbo links? Is there a work around?

stringByEvaluatingJavaScriptFromString method

Thanks for DZNWebViewController. It's an amazing WebViewController.

Should I use the method :
stringByEvaluatingJavaScriptFromString
inject my JavaScript to the webview?

Thanks for your help.

Share Actions

I would like to implement my own sharing actions in the DZNWebViewController to match the rest of the App, specifically using Facebook SDK and TwitterKit which permit deep linking to my app on the App Store. I already sub-classed DZNWebViewController and would like to know if you have any advice on how to proceed other than to expose properties in the M file to the H file, i.e re-coding your work. Thank you.

How to use a custom User Agent?

How may I define a custom user agent used by the DZNWebViewController?

The reason is, I've embedded a Knowledge Base website within my app using the DZNWebViewController. This website has some features which are nice for desktop, but not embedded within an app - so I'd like to hide those website features based on the user agent.

Why is must be iOS8+ only

I think it's better to add iOS8+ condition to decide iOS8+ only functions if can work.
There is still many users using iOS7.

Website title/url not positioning correctly

Okay, I guess I don't need to provide much info, the screenshots speak for themselves.

The URL I start with, everything works fine:

Then when I press the home icon of the blog, I get this:

I'm using the latest master branch code. Tested on iPhone 6 8.3 simulator and on 8.1 device.

Issue

It will be cool if you add reload/stop button.

Undefined symbols for architecture x86_64:

Hi, i used pods to import framework but now I can't build my project.

First I got 2 errors:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_DZNWebViewController", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Then I've added this to Other Linker Flags(I see this flag in example project): -l"Pods-DZNWebViewController"
And now I get this error:

ld: library not found for -lPods-DZNWebViewController
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I can't build after first try to allocate DZNWebViewController in my AppDelegate

DZNWebViewController *controller = [[DZNWebViewController alloc] initWithURL:[NSURL URLWithString:@"https://dribbble.com/"]];

What's wrong with my project?

Done button ?

Hi,
How to enable Done bar button item ?

Thank you

can't open local pdf file

Hello, I got local pdf when I open it using DZNWebViewController I get modal view with wired chars looks like crypted content. Here's my code :

let webView = DZNWebViewController.init(URL: fileLocalPath);

            let navigationController = UINavigationController.init(rootViewController: webView);
            navigationController.navigationBar.barTintColor = primaryColor;
            navigationController.navigationBar.tintColor = UIColor.whiteColor();
            navigationController.navigationBar.translucent = false;
            navigationController.navigationBar.barStyle = UIBarStyle.BlackTranslucent;
            navigationController.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "JFFlat-Medium", size: 22)!]


            self.presentViewController(navigationController, animated: true, completion: nil);

With this sample of code my file is opened normally without any issue:


            let req = NSURLRequest(URL: fileLocalPath)
            let webView = UIWebView(frame: CGRectMake(20,20,self.view.frame.size.width-40,self.view.frame.size.height-40))
            webView.loadRequest(req)
            self.view.addSubview(webView)

Add Cookies to request

I'm trying to use this control and add additional cookies to the requests so I can use it for authentication of a website.

How can this be done? I've tried adding code like this (and it's working with a default UIWebView), but with the DZNWebViewController, it's not working. I've tried initiating this code before or after the call to create DZNWebViewController.

[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];

///////////////////////////////

NSMutableDictionary *cookieProperties = [NSMutableDictionary dictionary];

[cookieProperties setObject:@"mem_websiteId" forKey:NSHTTPCookieName];

[cookieProperties setObject:email forKey:NSHTTPCookieValue];
[cookieProperties setObject:@"www.yourdomainname.com" forKey:NSHTTPCookieDomain];
[cookieProperties setObject:@"www.yourdomainname.com" forKey:NSHTTPCookieOriginURL];
[cookieProperties setObject:@"/" forKey:NSHTTPCookiePath];
[cookieProperties setObject:@"0" forKey:NSHTTPCookieVersion];

[cookieProperties setObject:[[NSDate date] dateByAddingTimeInterval:2629743] forKey:NSHTTPCookieExpires];

NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties];

[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];

Safe to use Private Property for LongPress?

In configureBarItemsGestures you are accessing the private View property of the UIBarButtonItems. Seems to be the best way due to the lack of UIBarButtonItems exposing their gesture Recognizers.

Are you aware of any App Store rejections caused by this?

EXC_BAD_ACCESS

I'm getting an EXC_BAD_ACCESS at the DZNWebViewController.m viewDidLoad.

I copied your sample code into my MainView ViewDidLoad which has a Nav Controller as the root to a ViewController. Also, the DZNWebNavigationPromptAll doesn't exist, I had to comment it out. Any suggestions?

NSURL *URL = [NSURL URLWithString:@"http://www.google.com/"];

DZNWebViewController *WVC = [[DZNWebViewController alloc] initWithURL:URL];
UINavigationController *NC = [[UINavigationController alloc] initWithRootViewController:WVC];

WVC.supportedWebNavigationTools = DZNWebNavigationToolAll;
WVC.supportedWebActions = DZNWebActionAll;
//WVC.webNavigationPrompt = DZNWebNavigationPromptAll;
WVC.showLoadingProgress = YES;
WVC.allowHistory = YES;
WVC.hideBarsWithGestures = YES;

Loading URLs

The web view controller works great with fully-qualified URLs like "http://www.foodster.io" but it does not work if you drop the scheme, e.g., "www.foodster.io"

Crashes when closing it as a modal

I have a tableview with 3 rows each with a button. When the user clicks on the button it opens up your view controller in a modal. What's weird is that it'll work fine if I open the modal when clicking on the button from the second or third row but when I try to click on the button on the first row it crashes with this error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x126162bf0 of class UINavigationBar was deallocated while key value observers were still registered with it.

<NSKeyValueObservationInfo 0x12607c780> (
<NSKeyValueObservance 0x126016bf0: Observer: 0x126166db0, Key path: hidden, Options: <New: YES, Old: NO, Prior: NO> Context: 0x10023fb18, Property: 0x1261319f0>
<NSKeyValueObservance 0x12606c9d0: Observer: 0x126166db0, Key path: center, Options: <New: YES, Old: NO, Prior: NO> Context: 0x10023fb18, Property: 0x1261325a0>
<NSKeyValueObservance 0x12606cae0: Observer: 0x126166db0, Key path: alpha, Options: <New: YES, Old: NO, Prior: NO> Context: 0x10023fb18, Property: 0x126132ad0>
)'

this is the code i'm using to open the URL:

var webModalNC: UINavigationController!
func showSource(url: String) {

        let vc = DZNWebViewController(URL: NSURL(string: url)!)
        self.webModalNC = UINavigationController(rootViewController: vc)
        vc.supportedWebNavigationTools = DZNWebNavigationTools.All
        vc.supportedWebActions = DZNsupportedWebActions.DZNWebActionAll
        vc.showLoadingProgress = true
        vc.hideBarsWithGestures = true
        vc.showPageTitleAndURL = true

        let closeButton = UIBarButtonItem(title: "Close", style: .Plain, target: self, action: #selector(HomeViewController.closeWebModal))
        vc.navigationItem.rightBarButtonItem = closeButton

        self.presentViewController(webModalNC, animated: true, completion: nil)

    }

    func closeWebModal(){

        self.webModalNC.dismissViewControllerAnimated(true, completion: nil)

    }

Do i need to remove observers manually before dismissing the modal?

Required load request method

how do i load request ?

let request = NSMutableURLRequest(URL: URL)
        request.HTTPMethod = "POST"
        request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")

        let post: String = "packageId=F77Dt4fb00&discountCode=test1212"
        let postData: NSData = post.dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true)!

        request.HTTPBody = postData
        WVC.webView.loadRequest(request)

Kudos for KVO/KVC with StatusBar and LongPress

Just a big thank you 👍

Your implementation of handling the visibility of the StatusBar when the NavigationBar is hidden by gestures is far superior to the usually seen approach which suggests putting a UIView below the StatusBar. It fixes a visual glitch seen with this common approach, too: the separator of the NavigationBar was moving over the background view. To be honest, it took me a moment to fully understand what you were doing but keeping track of previous superView, adjusting visibility, y Position and alpha of SubViews is very elegant.

The same thank you for the longPress handling which adds the gesture to the BarButtonItem's View.

Both solutions are very elegant and made me fully understand KVO/KVC and the power it provides. I am using this in Swift in my own Code, not only related to an implementation of a Browser.

If I'd a vote, this should become part of UIKit, especially the StatusBar handling is something I always missed with .hidesBarsOnSwipe.

Cheers,
Frederik

Close button

Am I missing something, or how is one suppose to close the view controller once presented?

URL loads but don't get callback of didFinish Navigation method or other callback methods

Hi,

I am loading a website url in DZNWebView, the project is in swift.

I am facing a weird issue where, the url load nicely initially and the delegate methods are also called appropriately like didFinishNavigation and other delegate methods, but for a particular url, none of the delegate methods fire, even the url on the navigation doesn't update, although the page is loaded on the web view. I am clueless, can anyone help?

Thanks,
Vishal

Dribble Example Error

Your example is a Dribble Page. When I tap on one of the Image boxes on that page it brings me to a screen where the entire page does not fit within the browser window.
simulator screen shot aug 21 2015 9 00 20 pm

Dismissing during page load causes KVO crash

Steps to reproduce

Somewhat intermittent, but:

  1. Present DZNWebViewController modally within a navigation controller
  2. Before its URL is loaded, press "Done"

Expected results

View controller is dismissed

Actual results

Crash due to premature destruction of object with key-value observers still attached:

Fatal Exception: NSInternalInconsistencyException
An instance 0x16611fe0 of class UINavigationBar was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x16617a60> ( <NSKeyValueObservance 0x17935770: Observer: 0x165f1480, Key path: hidden, Options: <New: YES, Old: NO, Prior: NO> Context: 0x172068, Property: 0x165f93c0> <NSKeyValueObservance 0x17937b30: Observer: 0x165f1480, Key path: center, Options: <New: YES, Old: NO, Prior: NO> Context: 0x172068, Property: 0x17937b60> <NSKeyValueObservance 0x16617a10: Observer: 0x165f1480, Key path: alpha, Options: <New: YES, Old: NO, Prior: NO> Context: 0x172068, Property: 0x16617a40> )

All the observers are instances of DZNWebViewController.

post method

Hi
How to open url with post method in dznwebviwe?

Thanks.

Carthage install not working

Error:
*** Skipped building DZNWebViewController due to the error:
Dependency "DZNWebViewController" has no shared framework schemes

Problems with Apple Review

Hi,

Im trying submit my app with this library, but Apple rejected it with the error message:

Dear Developer,

We identified one or more issues with a recent delivery for your app, "XYZ. Please correct the following issues, then upload again.

ITMS-90338: Non-public API usage - The app references non-public selectors in Frameworks/DZNWebViewController.framework/DZNWebViewController: estimatedProgress, isMainFrame, setNavigationDelegate:, targetFrame.

If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions.

In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.

For further information, visit the Technical Support Information at http://developer.apple.com/support/technical/Best regards,

The App Store Team

Thanks.

toolbarHidden

I have some questions about DZNWebViewController while push it then pop it:

  1. toolbar not hidden.
  2. progressView not hidden while request unfinished.
  3. networkActivityIndicatorVisible not hidden.

My Subclass solution:

  • (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    self.navigationController.toolbarHidden = YES;
    }

  • (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    // In viewWillDisappear do this can't hide while webview still request, may be KVO??
    UIProgressView *progressView = [self valueForKey:@"progressView"];
    if (progressView) {
    [progressView removeFromSuperview];
    progressView = nil;
    }

    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    }

Hide NavigationBar

Is it possible to hide the NavigationBar?

If I add to ViewDidLoad this: [[self navigationController] setNavigationBarHidden:YES animated:YES];
it is hidden. But after Swipe it shows again. I don't won't to turn off WVC.hideBarsWithGestures = YES;.

Short: How can I disable / hide the NavigationBar permanently?

Hide title url

Hey, @dzenbot
I found your webViewController is really helpful, especiall the ProgressView part. But in some case, the url in the titleView might appears a bit wierd. Maybe we can add a flag to hide it?

WKWebView

can you please update it with WKWebView

Support for popupwindow in few websites

Some website have Login with facebook/twitter option where javascript create a popup window and handles the request. Is it possible to add support for such popup windows?

KVO crash during dealloc when dismissing modal

*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <BRCWebViewController 0x7f96e2e88220> for the key path "hidden" from <UINavigationBar 0x7f96e2e209d0> because it is not registered as an observer.'

When using this component modally I made a subclass and added a dismiss button in the navbar during viewDidLoad. After dismissing it will crash.

Warnings in Xcode 8.3 and Swift 3.1

Hello there, I am getting several warnings since i updated my Xcode Version:

.../Pods/DZNWebViewController/Source/Classes/DZNWebViewController.m:69:1: Method possibly missing a [super awakeFromNib] call

.../Pods/DZNWebViewController/Source/Classes/DZNWebViewController.m:224:13: Logical not is only applied to the left hand side of this comparison

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.