this is my code and i want use this object to show loading progress,what should i do?
// view.h
#import <Cocoa/Cocoa.h>
#import<WebKit/WebKit.h>
@interface view : NSObject {
IBOutlet WebView* webview;
}
-(IBAction) google:(id) sender;
@end
//view.m
#import "view.h"
@implementation view
-(IBAction) google:(id) sender
{
[[webview mainFrame] loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.google.com/finance/converter"]]];
}
开发者_如何学编程 @end
Look at WebResourceLoadDelegate. Also, from WebView class reference page:
Another way to monitor load progress with less control is to observe the WebViewProgressEstimateChangedNotification, WebViewProgressFinishedNotification, and WebViewProgressStartedNotification notifications. For example, you could observe these notifications to implement a simple progress indicator in your application. You update the progress indicator by invoking the estimatedProgress method to get an estimate of the amount of content that is currently loaded.
精彩评论