dzenbot / dznwebviewcontroller Goto Github PK
View Code? Open in Web Editor NEWA simple web browser for iPhone & iPad with similar features than Safari's
Home Page: https://www.cocoacontrols.com/controls/dznwebviewcontroller
License: MIT License
A simple web browser for iPhone & iPad with similar features than Safari's
Home Page: https://www.cocoacontrols.com/controls/dznwebviewcontroller
License: MIT License
I added DZNWebViewController to my project using Cocoapods. Now, however, all the images/icons don't show up, for ex. for the toolbar items.
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
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?
Please help me on this i have http://www.example.com.
Suppose if i want to use this as a initial view controller, how do i pass a url once view is loaded?
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?
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
DZNWebViewController (= 3.1)
dependency were found, but they required a higher minimum deployment target.If I use pod 'DZNWebViewController', than it installs v2.
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.
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?
Thanks for DZNWebViewController. It's an amazing WebViewController.
Should I use the method :
stringByEvaluatingJavaScriptFromString
inject my JavaScript to the webview?
Thanks for your help.
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 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.
toolbar is blocking the bottom of website content
I think it's better to add iOS8+ condition to decide iOS8+ only functions if can work.
There is still many users using iOS7.
it reports [!] Unable to find a specification for DZWebBrowser (~> 0.0.1)
.
recent source has resolved the issue so i think it would be nice to up to date release another version for cocoapods users
It will be cool if you add reload/stop button.
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?
Hi,
How to enable Done bar button item ?
Thank you
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)
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];
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?
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;
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"
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?
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)
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
Am I missing something, or how is one suppose to close the view controller once presented?
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
Somewhat intermittent, but:
DZNWebViewController
modally within a navigation controllerView controller is dismissed
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
.
Hi
How to open url with post method in dznwebviwe?
Thanks.
Error:
*** Skipped building DZNWebViewController due to the error:
Dependency "DZNWebViewController" has no shared framework schemes
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.
I have some questions about DZNWebViewController while push it then pop it:
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;
}
Any chance for Carthage support?
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?
I can't find how to put a button to dismiss the web view after it's loaded. Any ideas?
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?
can you please update it with WKWebView
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?
*** 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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.