Mobile SDK iOS: EPZWebView

From ePrize Developers Wiki

(Difference between revisions)
Jump to: navigation, search

Revision as of 21:21, 6 November 2014

Contents

Overview

The EPZWebView is a UIView that includes a built-in UIWebView that loads and displays web content. It is designed to fill the entire area of its parent container, and has appropriate logic to allow for device rotation. The EPZPromoWebViewController uses an instance of this class for its web view. If you do not wish to use the SDK's built-in EPZPromoWebViewController, you can use an instance of this class, adding it to your own view controller as needed. This view includes basic web view navigation methods and properties that you can use to, for instance, to manage your own toolbar that includes forward/back/refresh buttons for the web view.


Tasks

Setting and Getting the Delegate
  delegate property

Loading content
- loadURL:

Retrieving web page URL
  currentURL property

Navigating the web view
  isLoading property
  canGoBack property
  canGoForward property
- reload
- goBack
- goForward


Properties

delegate

The receiver's delegate.

@property (nonatomic, assign) id <EPZWebViewDelegate> delegate

Discussion
The delegate is sent messages when the view is created, as well as when it is targeted to close. See EPZWebViewDelegate for methods this delegate implements.

Declared In
EPZWebView.h



isLoading

Flag for whether or not the web view is in the act of loading content.

@property (nonatomic, readonly) BOOL isLoading

Declared In
EPZWebView.h



canGoBack

Flag for whether or not the web view can navigate back.

@property (nonatomic, readonly) BOOL canGoBack

Declared In
EPZWebView.h



canGoForward

Flag for whether or not the web view can navigate forward.

@property (nonatomic, readonly) BOOL canGoForward

Declared In
EPZWebView.h



currentURL

The current URL that is loaded in the web view.

@property (nonatomic, readonly) NSString *currentURL

Declared In
EPZWebView.h


Instance Methods

loadURL:

Initializes and returns a newly allocated view object with the specified items from the options.

- (void) loadURL:(NSString *)url

Parameters

url
The URL to load into the web view.

Discussion
This method must be called to load a URL into the web view. If not called, the web view will be left with a blank request and nothing will be shown.

Declared In
EPZWebView.h



reload

Method to reload the current web page.

- (void) reload

Discussion
This method can be called to reload the current web page.

Declared In
EPZWebView.h



goBack

Method to navigate back in the web view, if possible.

- (void) goBack

Discussion
This method can be called to navigate back in the web view, if possible.

Declared In
EPZWebView.h



goForward

Method to navigate forward in the web view, if possible.

- (void) goForward

Discussion
This method can be called to navigate forward in the web view, if possible.

Declared In
EPZWebView.h



stringByEvaluatingJavaScriptFromString:

Returns the result of running a script.

- (NSString *) stringByEvaluatingJavaScriptFromString:(NSString *)script

Returns
The result of running script or nil if it fails.

Discussion
JavaScript allocations are limited to 10 MB. The web view raises an exception if you exceed this limit on the total memory allocation for JavaScript.

Declared In
EPZWebView.h

Personal tools