實現類似微信的 webView 導航效果:RxWebViewController

jopen 9年前發布 | 27K 次閱讀 Android開發 移動開發 RxWebViewController
實現類似微信的 webView 導航效果,包括進度條,左滑返回上個網頁或者直接關閉,就像 UINavigationController。

it's a custom UIWebViewController that navigate like navigationController,just like wechat do.

實現類似微信的webView導航效果,左滑返回上個網頁,就像UINavigationController

like the screen shot gif

image

usage使用

Install 安裝


You just need to drag/copy the "RxWebViewController" folder and drop in your project 將“RxWebViewController”文件夾拖進你的工程中即可

init and push


usage is simple

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

項目主頁:http://www.baiduhome.net/lib/view/home/1445848432898

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!