TCGBWebView Class Reference

Inherits from NSObject
Declared in TCGBWebView.h

Overview

The TCGBWebView class represents the entry point for launching WebView.

Properties

  defaultWebConfiguration

This property is a global configuration for launching webview.
When you handle the webview without any configuration, TCGBWebView set its configuration with this value.

@property (nonatomic, strong) TCGBWebViewConfiguration *defaultWebConfiguration

Declared In

TCGBWebView.h

  schemeCallbackDictionary

This dictionary contains key-action objectes.
Each key represents custom scheme, and each action is completionHandler.

@property (nonatomic, strong) NSMutableDictionary *schemeCallbackDictionary

Declared In

TCGBWebView.h

Initialization

+ sharedTCGBWebView

Creates and returns an TCGBWebView object.

+ (instancetype)sharedTCGBWebView

Declared In

TCGBWebView.h

Launching WebView

+ showWebBrowserWithURL:viewController:

Show Web Browser that has navigationbar and fullscreen. (Deprecated: As of release 1.5.0, use showWebViewWithURL:viewController:configuration:closeCompletion:schemeList:schemeEvent: method instead.)

+ (void)showWebBrowserWithURL:(NSString *)urlString viewController:(UIViewController *)viewController

Parameters

urlString

The string value for target url

viewController

The presenting view controller

Availability

Added 1.4.0.

Discussion

Warning: If viewController is nil, TCGBWebView set it to top most view controller automatically.

Declared In

TCGBWebView.h

+ showWebViewWithURL:viewController:configuration:

Show WebView that is not for local url. (Deprecated: As of release 1.5.0, use showWebViewWithURL:viewController:configuration:closeCompletion:schemeList:schemeEvent: method instead.)

+ (void)showWebViewWithURL:(NSString *)urlString viewController:(UIViewController *)viewController configuration:(TCGBWebViewConfiguration *)configuration

Parameters

urlString

The string value for target url

viewController

The presenting view controller

configuration

This configuration is applied to the behavior of webview.

Availability

Added 1.4.0.

Discussion

Warning: If viewController is nil, TCGBWebView set it to top most view controller automatically.

Warning: If configuration is nil, TCGBWebView set it to default value. It is described in TCGBWebViewConfiguration.

Declared In

TCGBWebView.h

+ showWebViewWithURL:viewController:configuration:closeCompletion:schemeList:schemeEvent:

Show WebView that is not for local url.

+ (void)showWebViewWithURL:(NSString *)urlString viewController:(UIViewController *)viewController configuration:(TCGBWebViewConfiguration *)configuration closeCompletion:(TCGBWebViewCloseCompletion)closeCompletion schemeList:(NSArray<NSString*> *)schemeList schemeEvent:(TCGBWebViewSchemeEvent)schemeEvent

Parameters

urlString

The string value for target url

viewController

The presenting view controller

configuration

This configuration is applied to the behavior of webview.

closeCompletion

This completion would be called when webview is closed

schemeList

This schemeList would be filtered every web view request and call schemeEvent

schemeEvent

This schemeEvent would be called when web view request matches one of the schemeLlist

Availability

Added 1.5.0.

Discussion

Warning: If viewController is nil, TCGBWebView set it to top most view controller automatically.

Warning: If configuration is nil, TCGBWebView set it to default value. It is described in TCGBWebViewConfiguration.

Declared In

TCGBWebView.h

+ showWebViewWithLocalURL:bundle:viewController:configuration:closeCompletion:schemeList:schemeEvent:

Show WebView for local html (or other web resources)

+ (void)showWebViewWithLocalURL:(NSString *)filePath bundle:(NSBundle *)bundle viewController:(UIViewController *)viewController configuration:(TCGBWebViewConfiguration *)configuration closeCompletion:(TCGBWebViewCloseCompletion)closeCompletion schemeList:(NSArray<NSString*> *)schemeList schemeEvent:(TCGBWebViewSchemeEvent)schemeEvent

Parameters

filePath

The string value for target local path.

bundle

where the html file is located.

viewController

The presenting view controller

configuration

This configuration is applied to the behavior of webview.

closeCompletion

This completion would be called when webview is closed

schemeList

This schemeList would be filtered every web view request and call schemeEvent

schemeEvent

This schemeEvent would be called when web view request matches one of the schemeLlist

Availability

Added 1.5.0.

Discussion

Warning: If bundle is nil, TCGBWebView set it to main bundle automatically.

Warning: If viewController is nil, TCGBWebView set it to top most view controller automatically.

Warning: If configuration is nil, TCGBWebView set it to default value. It is described in TCGBWebViewConfiguration.

Declared In

TCGBWebView.h

+ openWebBrowserWithURL:

Open the Browser with urlString

+ (void)openWebBrowserWithURL:(NSString *)urlString

Parameters

urlString

The URL to be loaded.

Availability

Added 1.5.0.

Discussion

Warning: If urlString is not valid, to open browser would be failed. Please check the url before calling.

Declared In

TCGBWebView.h

+ closeWebView

Close the presenting Webview

+ (void)closeWebView

Availability

Added 1.5.0.

Declared In

TCGBWebView.h

Managing Custom Scheme

+ addCustomScheme:block:

Add Custom Scheme

+ (void)addCustomScheme:(NSString *)schemeString block:(void ( ^ ) ( UIViewController<TCGBWebViewDelegate> *viewController , TCGBWebURL *webURL ))handler

Parameters

schemeString

This string is the key that is called in html or the other place.

handler

This handler is a block which will be excuted by calling the schemeString, the key.

Declared In

TCGBWebView.h

+ removeCustomScheme:

Remove Custom Scheme

+ (void)removeCustomScheme:(NSString *)schemeString

Parameters

schemeString

This string is the key of schemeCallbackDictionary.

Declared In

TCGBWebView.h