Contain two mode:wechat browser and Safari browser. A web view controller class for iOS that allows users to view web pages directly within an app similar as wechat.Using Safari mode, contains goBack,goForward,shareAction,refresh and stop function at toolbar
分为两种模式,一种是类似微信内置浏览器模式,一种是Safari浏览器模式。类似微信内置浏览器,顶部导航栏提供webview后退和关闭按钮.Safari模式,底部toolbar带有前进,后退,分享,刷新的功能。
Cocoapods
pod 'CYWebviewController'
Manual
把项目中的CY文件夹拉近自己的项目就可以了
Pull "CY" file to your project
#import "CYWebViewController.h"
#import "UINavigationBar+Awesome.h"可以设置UINavigationBar
#import "UIButton+WHE.h"
#import "UIButton+WHE.h"自定义返回按钮
#import "UIButton+WHE.h"
#import "UIColor+WHE.h"HEX颜色转为RGB颜色
#import "UIColor+WHE.h"
import
#import "CYWebViewController.h"
使用微信内置浏览器模式
Using Wechat mode
CYWebViewController *controller = [[CYWebViewController alloc] init];
controller.url = @"https://www.baidu.com/";
controller.loadingBarTintColor = [UIColor redColor];
[self.navigationController pushViewController:controller animated:YES];
使用Safari 模式,底部toolbar带有前进,后退,分享,刷新的功能。
Using Safari mode, contains goBack,goForward,shareAction,refresh and stop function at toolbar. Push ViewController
CYWebViewController *controller = [[CYWebViewController alloc] init];
controller.url = [NSURL URLWithString:@"https://www.baidu.com/"];
controller.loadingBarTintColor = [UIColor redColor];
controller.navigationButtonsHidden = NO;
[self.navigationController pushViewController:controller animated:YES];
presentViewController
CYWebViewController *controller = [[CYWebViewController alloc] init];
controller.url = [NSURL URLWithString:@"https://www.baidu.com/"];
controller.loadingBarTintColor = [UIColor redColor];
controller.navigationButtonsHidden = NO;
[self presentViewController:[[UINavigationController alloc] initWithRootViewController:controller] animated:YES completion:nil];