转载链接:http://blog.csdn.net/lixuwen521/article/details/9293257
Setting the Delegate
- delegate
Loading Content
- 1.- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL
设置主页面的内容,MIME类型,内容编码格式,基本的内容URL
简单测试发现设置不设置MIMEType和encodingName都没什么影响,有新发现了会更新此文章的。
- 2.- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
- 3.- (void)loadRequest:(NSURLRequest *)request
- 4.@property(nonatomic, readonly, retain) NSURLRequest *request
- 5.@property(nonatomic, readonly, getter=isLoading) BOOL loading
- 5.- (void)stopLoading
停止加载页面
- 6.- (void)reload
重新加载此页面
Moving Back and Forward
- 1.@property(nonatomic, readonly, getter=canGoBack) BOOL canGoBack
- 2.@property(nonatomic, readonly, getter=canGoForward) BOOL canGoForward
- 3.- (void)goBack
- 4.- (void)goForward
Setting Web Content Properties
- 1.@property(nonatomic) BOOL scalesPageToFit
- 2.@property(nonatomic, readonly, retain) UIScrollView *scrollView
Available in iOS 6.0 and later.
Webview的一个子类
- 3.@property(nonatomic) BOOL suppressesIncrementalRendering
Available in iOS 6.0 and later.默认值为NO.
这个值决定了网页内容的渲染是否在把内容全部加载到内存中再去处理。
如果设置为YES,只有网页内容加载到内存里了才会去渲染
When set to YES, the web view does not attempt to render incoming content as it arrives. Instead, the view’s current contents remain in place until all of the new content has been received, at which point the new content is rendered. This property does not affect the rendering of content retrieved after a frame finishes loading.
- 4.@property (nonatomic) BOOL keyboardDisplayRequiresUserAction
Available in iOS 6.0 and later.默认是YES
如果设置为YES,用户必须明确的点击页面上的元素或者相关联的输入页面来显示键盘;如果设置为NO,一个元素的焦点事件导致输入视图的显示和自动关联这个元素。
- 5.@property(nonatomic) BOOL detectsPhoneNumbers
Deprecated in iOS 3.0. UsedataDetectorTypes instead.
Running JavaScript
- 1.- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
JavaScript的执行时间被限定在10秒钟,如果执行时间超过10秒,那么页面就停止执行这个脚本。JavaScript的执行或许能够阻塞主线程,所以当脚本执行的时候不允许用户影响页面的加载。
JavaScript的内存分配被限制在10M,如果超出这个限制那么页面会发生异常。
Detecting Types of Data
- 1.@property(nonatomic) UIDataDetectorTypes dataDetectorTypes
- enum {
- UIDataDetectorTypePhoneNumber = 1 << 0,
- UIDataDetectorTypeLink = 1 << 1,
- UIDataDetectorTypeAddress = 1 << 2,
- UIDataDetectorTypeCalendarEvent = 1 << 3,
- UIDataDetectorTypeNone = 0,
- UIDataDetectorTypeAll = NSUIntegerMax
- };
- typedef NSUInteger UIDataDetectorTypes;
把网页上内容转换成可点击的链接
Managing Media Playback
- 1.@property(nonatomic) BOOL allowsInlineMediaPlayback
默认使NO。这个值决定了用内嵌HTML5播放视频还是用本地的全屏控制。
为了内嵌视频播放,不仅仅需要在这个页面上设置这个属性,还必须的是在HTML中的video元素必须包含webkit-playsinline属性。- 2.@property(nonatomic) BOOL mediaPlaybackRequiresUserAction
- 3.@property(nonatomic) BOOL mediaPlaybackAllowsAirPlay
Available in iOS 5.0 and later.在iPhone和iPad上默认使YES。