0

私は iOS プログラミングが初めてで、簡単なアプリを作成しています。最初の UITabBarItem はページをロードしますが、ロードする前にラベルがあります。Web ページの読み込み後にラベルを非表示にしようとしていますが、うまくいきません。Web ビュー デリゲートを設定する必要があると思いますが、その方法がわかりません。

firstcontroller.h

#import <UIKit/UIKit.h>

@interface OTFFirstViewController : UIViewController

@property (strong, nonatomic) IBOutlet UIWebView *webPage;

@property (strong, nonatomic) IBOutlet UILabel *pageLoading;

@end

firstcontroller.m

#import "FirstViewController.h"

@interface FirstViewController ()

@end

@implementation FirstViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    NSString *fullURL = @"http://asdf.com";
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [_webPage loadRequest:requestObj];
}

- (void)webViewDidFinishLoad:(UIWebView *)_webPage
{
    _pageLoading.hidden = YES;

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
4

1 に答える 1

1

_webPage.delegate = self;を呼び出す前に挿入しloadRequest:ます。
インターフェイス定義も に変更する必要があります@interface OTFFirstViewController : UIViewController <UIWebViewDelegate>

于 2013-07-12T03:12:00.967 に答える