RxWebViewController 0.0.2

RxWebViewController 0.0.2

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2016年3月

horsleyli 维护。




  • 作者
  • Horsley Lee

更新-15.12.9 为了解决普通 viewController 会出现的各种 pop 问题,弃用之前的 category 形式,改为子类化了 UINavigationController,所以大家需要继承 RxWebViewNavigationViewController 作为您的 navigationController!

更新 - 15.12.9 为了解决普通 viewControllers 的 pop 问题,我在 RXWebViewController 中弃用了 category 形式,并添加了 UINavigationController 的子类,因此您需要继承 RxWebViewNavigationViewController 作为您的 custom navigationController


这是一个类似 navigationController 导航的 custom UIWebViewController,就像微信那样。

实现类似微信的 webView 导航效果,左滑返回上一个网页,就像 UINavigationController

如下图所示

image

使用

安装


只需要将“RxWebViewController”文件夹拖入你的项目中即可。

初始化和推送


使用非常简单

-------警告-------- ①,您应该子类化一个 navigationController

    #import "RxWebViewNavigationViewController.h"

    @interface myNavigationViewController : RxWebViewNavigationViewController

    @end

然后,将 webviewController 作为普通的 viewController 使用

    NSString* urlStr = @"http://github.com";
    RxWebViewController* webViewController = [[RxWebViewController alloc] initWithUrl:[NSURL URLWithString:urlStr]];
    [self.navigationController pushViewController:webViewController animated:YES];

and if you want to do some custom things with webview, just subclass it 如果你需要webview的更进一步自定义,子类化即可

    @interface myWebViewController : RxWebViewController

    //do your custom things

    @end

navigation bar tint color and back button style 导航栏的颜色和返回按钮样式

导航栏中出现的 “返回” 和 “关闭”,均会继承你的 navigationController 中对 navigationBar 的设置,比如:

    UIColor* tintColor = [UIColor whiteColor];
    UIColor* barTintColor = [UIColor blueColor];
    self.navigationController.navigationBar.tintColor = tintColor;
    self.navigationController.navigationBar.barTintColor = barTintColor;
    [self.navigationController.navigationBar setTitleTextAttributes:@{                                                                      NSForegroundColorAttributeName:tintColor
                                                                  }];

这样来自定义你的navigationBar各控件颜色,webViewController中会遵循此设置,如图 image

也可以像微信那样在你的 navigationBar 中使用自定义的 backButtonBackgroundImage,如图

image

Thanks


我使用了 NJKWebViewProgress 来做导航进度,它非常有帮助