Giter VIP home page Giter VIP logo

Comments (10)

XAmateur avatar XAmateur commented on July 18, 2024

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.

joeljfischer avatar joeljfischer commented on July 18, 2024

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.

JonErickson avatar JonErickson commented on July 18, 2024

I have done this however a back button does not appear.

from dznwebviewcontroller.

sachinkesiraju avatar sachinkesiraju commented on July 18, 2024

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.

abidullah avatar abidullah commented on July 18, 2024

@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.

sachinkesiraju avatar sachinkesiraju commented on July 18, 2024

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
ios simulator screen shot jan 20 2015 8 52 43 pm

from dznwebviewcontroller.

haoyuexing avatar haoyuexing commented on July 18, 2024

@abidullah i have the same issue. when i close the VC. crash. did u fix it?

from dznwebviewcontroller.

abidullah avatar abidullah commented on July 18, 2024

@haoyuexing No it still crash

from dznwebviewcontroller.

DreamingInBinary avatar DreamingInBinary commented on July 18, 2024

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.

haoyuexing avatar haoyuexing commented on July 18, 2024

@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)

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.