/Pods/Headers/Private/KINWebBrowser/KINWebBrowserViewController.h

https://gitlab.com/pqhuy1987/Mahaikum · C Header · 139 lines · 38 code · 32 blank · 69 comment · 0 complexity · 9ad8183e3bb917de5c84b95e03f358e8 MD5 · raw file

  1. //
  2. // KINWebBrowserViewController.h
  3. //
  4. // KINWebBrowser
  5. //
  6. // Created by David F. Muir V
  7. // dfmuir@gmail.com
  8. // Co-Founder & Engineer at Kinwa, Inc.
  9. // http://www.kinwa.co
  10. //
  11. // The MIT License (MIT)
  12. //
  13. // Copyright (c) 2014 David Muir
  14. //
  15. // Permission is hereby granted, free of charge, to any person obtaining a copy of
  16. // this software and associated documentation files (the "Software"), to deal in
  17. // the Software without restriction, including without limitation the rights to
  18. // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  19. // the Software, and to permit persons to whom the Software is furnished to do so,
  20. // subject to the following conditions:
  21. //
  22. // The above copyright notice and this permission notice shall be included in all
  23. // copies or substantial portions of the Software.
  24. //
  25. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  29. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  31. //
  32. #import <UIKit/UIKit.h>
  33. #import <WebKit/WebKit.h>
  34. @class KINWebBrowserViewController;
  35. /*
  36. UINavigationController+KINWebBrowserWrapper category enables access to casted KINWebBroswerViewController when set as rootViewController of UINavigationController
  37. */
  38. @interface UINavigationController(KINWebBrowser)
  39. // Returns rootViewController casted as KINWebBrowserViewController
  40. - (KINWebBrowserViewController *)rootWebBrowser;
  41. @end
  42. @protocol KINWebBrowserDelegate <NSObject>
  43. @optional
  44. - (void)webBrowser:(KINWebBrowserViewController *)webBrowser didStartLoadingURL:(NSURL *)URL;
  45. - (void)webBrowser:(KINWebBrowserViewController *)webBrowser didFinishLoadingURL:(NSURL *)URL;
  46. - (void)webBrowser:(KINWebBrowserViewController *)webBrowser didFailToLoadURL:(NSURL *)URL error:(NSError *)error;
  47. - (void)webBrowserViewControllerWillDismiss:(KINWebBrowserViewController*)viewController;
  48. @end
  49. /*
  50. KINWebBrowserViewController is designed to be used inside of a UINavigationController.
  51. For convenience, two sets of static initializers are available.
  52. */
  53. @interface KINWebBrowserViewController : UIViewController <WKNavigationDelegate, WKUIDelegate, UIWebViewDelegate>
  54. #pragma mark - Public Properties
  55. @property (nonatomic, weak) id <KINWebBrowserDelegate> delegate;
  56. // The main and only UIProgressView
  57. @property (nonatomic, strong) UIProgressView *progressView;
  58. // The web views
  59. // Depending on the version of iOS, one of these will be set
  60. @property (nonatomic, strong) WKWebView *wkWebView;
  61. @property (nonatomic, strong) UIWebView *uiWebView;
  62. - (id)initWithConfiguration:(WKWebViewConfiguration *)configuration NS_AVAILABLE_IOS(8_0);
  63. #pragma mark - Static Initializers
  64. /*
  65. Initialize a basic KINWebBrowserViewController instance for push onto navigation stack
  66. Ideal for use with UINavigationController pushViewController:animated: or initWithRootViewController:
  67. Optionally specify KINWebBrowser options or WKWebConfiguration
  68. */
  69. + (KINWebBrowserViewController *)webBrowser;
  70. + (KINWebBrowserViewController *)webBrowserWithConfiguration:(WKWebViewConfiguration *)configuration NS_AVAILABLE_IOS(8_0);
  71. /*
  72. Initialize a UINavigationController with a KINWebBrowserViewController for modal presentation.
  73. Ideal for use with presentViewController:animated:
  74. Optionally specify KINWebBrowser options or WKWebConfiguration
  75. */
  76. + (UINavigationController *)navigationControllerWithWebBrowser;
  77. + (UINavigationController *)navigationControllerWithWebBrowserWithConfiguration:(WKWebViewConfiguration *)configuration NS_AVAILABLE_IOS(8_0);
  78. @property (nonatomic, strong) UIBarButtonItem *actionButton;
  79. @property (nonatomic, strong) UIColor *tintColor;
  80. @property (nonatomic, strong) UIColor *barTintColor;
  81. @property (nonatomic, assign) BOOL actionButtonHidden;
  82. @property (nonatomic, assign) BOOL showsURLInNavigationBar;
  83. @property (nonatomic, assign) BOOL showsPageTitleInNavigationBar;
  84. //Allow for custom activities in the browser by populating this optional array
  85. @property (nonatomic, strong) NSArray *customActivityItems;
  86. #pragma mark - Public Interface
  87. // Load a NSURLURLRequest to web view
  88. // Can be called any time after initialization
  89. - (void)loadRequest:(NSURLRequest *)request;
  90. // Load a NSURL to web view
  91. // Can be called any time after initialization
  92. - (void)loadURL:(NSURL *)URL;
  93. // Loads a URL as NSString to web view
  94. // Can be called any time after initialization
  95. - (void)loadURLString:(NSString *)URLString;
  96. // Loads an string containing HTML to web view
  97. // Can be called any time after initialization
  98. - (void)loadHTMLString:(NSString *)HTMLString;
  99. @end