Comments (10)
I have the same issue.I present this controller and I add a dismiss barbutton just like others ,then when I dismiss it ,the issue appears .
put "_webView.scrollView.delegate = nil;" to dealloc method .It may work
But it still has warning in console : <CATransformLayer: 0x7ca8e0e0> - changing property opaque in transform-only layer, will have no effect ;
To fix it ,try this :
http://stackoverflow.com/questions/12341463/using-catransformlayer-warning-changing-property-opaque-in-transform-only-layer
from dznwebviewcontroller.
I believe it's meant to be used on a UINavigationController, which means it would receive a back button like any other View Controller would.
from dznwebviewcontroller.
I have done this however a back button does not appear.
from dznwebviewcontroller.
I found a way to add a back button to the web controller.
You'll need to add the bar button item to DZNWebViewController's navigation item rather than to the navigation item on the navigation controller.
DZNWebViewController *controller = [[DZNWebViewController alloc] initWithURL:[NSURL URLWithString:@"https://google.com/"]];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"CLOSE" style:UIBarButtonItemStylePlain target:self action:@selector(closeButtonWithWebView:)];
controller.navigationItem.rightBarButtonItem = closeButton;
from dznwebviewcontroller.
@sachinkesiraju i tried the same but when i select close button the view controller exits but crashes , any idea how u did it , can u share that code
from dznwebviewcontroller.
Hmm, it works just fine for me. Here's the code I'm using.
@property (strong, nonatomic) UINavigationController *navController; (in the @interface)
- (void) close
{
NSLog(@"Closing view");
[_navController dismissViewControllerAnimated:YES completion:nil];
}
- (void) openWebsiteWithURL: (NSString *) URL
{
DZNWebViewController *webViewController = [[DZNWebViewController alloc] initWithURL:[NSURL URLWithString:URL]];
_navController = [[UINavigationController alloc] initWithRootViewController:webViewController];
webViewController.supportedWebActions = DZNWebActionAll;
webViewController.supportedWebNavigationTools = DZNWebNavigationToolAll;
webViewController.showLoadingProgress = YES;
webViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(close)];
[self presentViewController:_navController animated:YES completion:nil];
}
And this is what it looks like
from dznwebviewcontroller.
@abidullah i have the same issue. when i close the VC. crash. did u fix it?
from dznwebviewcontroller.
@haoyuexing No it still crash
from dznwebviewcontroller.
You can fix this by using a static context on your wrapper class to open a URL. Here is mine:
//
// WebHelper.h
// HaloTimer
//
// Created by Jordan Morgan on 2/24/15.
// Copyright (c) 2015 Jordan Morgan. All rights reserved.
//
#import <Foundation/Foundation.h>
@class DZNWebViewController;
@interface WebHelper : NSObject
+ (void)openURL:(NSURL *)url fromViewController:(UIViewController *)sender;
@end
And the implementation:
//
// WebHelper.m
// HaloTimer
//
// Created by Jordan Morgan on 2/24/15.
// Copyright (c) 2015 Jordan Morgan. All rights reserved.
//
#import "WebHelper.h"
#import "DZNWebViewController.h"
static UINavigationController *navVC = nil;
static DZNWebViewController *webVC = nil;
@implementation WebHelper
+ (void)openURL:(NSURL *)url fromViewController:(UIViewController *)sender
{
if (!navVC && !webVC)
{
webVC = [[DZNWebViewController alloc] initWithURL:url];
navVC = [[UINavigationController alloc] initWithRootViewController:webVC];
}
else
{
webVC.URL = url;
}
webVC.supportedWebNavigationTools = DZNWebNavigationToolAll;
webVC.supportedWebActions = DZNWebActionAll;
webVC.showLoadingProgress = YES;
webVC.allowHistory = YES;
webVC.hideBarsWithGestures = YES;
webVC.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(close)];
[sender presentViewController:navVC animated:YES completion:NULL];
}
+ (void)close
{
[navVC dismissViewControllerAnimated:YES completion:nil];
}
@end
from dznwebviewcontroller.
@DreamingInBinary It's worked. but another issue here. open first page -> close -> open second page. now "back button" can be click. It will back to the first page. i think the logic is wrong. how can i open this VC without the previous record?! thanks.
from dznwebviewcontroller.
Related Issues (20)
- Turbolinks not enabling back/forward buttons HOT 1
- HTTP urls not working please help me on this HOT 2
- Dismissing during page load causes KVO crash HOT 10
- Loading URLs HOT 1
- Carthage support? HOT 5
- How to use a custom User Agent? HOT 4
- Required load request method HOT 3
- Support for popupwindow in few websites HOT 3
- toolbarHidden HOT 1
- EXC_BAD_ACCESS
- How to dismiss the view? HOT 4
- how to play video in website HOT 1
- Undefined symbols for architecture x86_64: HOT 1
- Warnings in Xcode 8.3 and Swift 3.1
- Carthage install not working
- toolbar block bottom of website content
- post method
- URL loads but don't get callback of didFinish Navigation method or other callback methods HOT 1
- iOS 11 status bar overlaps with DZWebViewController top bar HOT 1
- Problems with Apple Review
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dznwebviewcontroller.