2
Webview에서 원격 URL을로드하고 있으며 컨텐츠가로드되는 동안 회 전자를 표시하려고합니다. 다음 코드는 있지만 콘텐츠로드가 끝나면 회 전자가 사라지지 않습니다. 콘텐츠가로드 된 후 회 전자가 사라지도록하려면 어떻게해야합니까?Webview Xcode의 회 전자로드
NSURL *noteURL = [NSURL URLWithString:@"http://google.com/"];
NSString *defaultNote = @"Hello there";
NSRect frame = [[noteView superview] frame];
noteSpinner = [[[NSProgressIndicator alloc] initWithFrame:NSMakeRect(NSMidX(frame)-16, NSMidY(frame)-16, 32, 32)] autorelease];
[noteSpinner setStyle:NSProgressIndicatorSpinningStyle];
[noteSpinner startAnimation:self];
//webViewFinishedLoading = NO;
[[noteView superview] addSubview:noteSpinner];
if (noteURL)
{
if ([noteURL isFileURL])
{
[[noteView mainFrame] loadHTMLString:@"Release notes with file:// URLs are not supported for security reasons—Javascript would be able to read files on your file system." baseURL:nil];
}
else
{
[[noteView mainFrame] loadRequest:[NSURLRequest requestWithURL:noteURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]];
}
}
else
{
[[noteView mainFrame] loadHTMLString:defaultNote baseURL:nil];
}
메인 프레임로드가 언제 완료되는지 어떻게 알 수 있습니까? – Chetan
무슨 뜻입니까? 'stopAnimation' 명령은 어디에 두어야합니까? – Chetan
신경 쓰지 마라. 기록을 위해, 동일한 클래스에 다음 함수를 정의 할 필요 - (무효) 웹보기 (웹뷰 *) 발신자 didFinishLoadForFrame : 프레임 { \t 경우 ([프레임 parentFrame] == 닐) { \t \t [noteSpinner setHidden : YES]; \t \t [발신자 표시]; } } – Chetan