2013-07-10 1 views
-1

웹 페이지가로드되는 동안 ATM HUD를 사용하는 UIWebView가 있습니다. HUD가 작동하기 시작하도록 할 수는 있지만 웹 페이지가로드 된 후에도 HUD가 계속 작동합니다. 한 번로드 한 HUD가 회전을 멈추게하는 방법을 찾아야합니다. 아래 코드는 지금까지 가지고있는 코드입니다.IOS 프로젝트 용 UIWebView에서 HUD를 숨길 수 없습니다

@implementation ThenewsViewController 

@synthesize hud; 

- (void)showHud { 
    // Show hud with activity indicator 
    NSLog(@"hud: %@", hud); 
    if (!hud) { 
     hud = [[ATMHud alloc] initWithDelegate:self]; 
     [self.navigationController.view addSubview:hud.view]; 
     [hud setCaption:@"Loading news..."]; 
     [hud setActivity:YES]; 
     [hud update]; 

     if (![hud isBeingPresented]) 
      [hud show]; 
    } else { 
     NSLog(@"hud exists... resetting."); 
     hud = nil; 
     [self showHud]; 
    } 
} 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 

} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    NSURL *myURL = [NSURL URLWithString:@"http://www.hiphopdx.com/m/index.php?s=news"]; 

    NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL]; 

    [myWebView loadRequest:myRequest]; 

    UIColor *navBarColor = UIColorFromRGB(0x089932); 
    [[self.navigationController navigationBar] setTintColor:navBarColor]; 

    if (![hud isBeingPresented]) 
     [self showHud]; 

} 

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

} 

- (void)viewDidFinishLoad:(UIWebView *)webView 
{ 

    NSLog(@"Done loading web view"); 
    [hud hide]; 
} 

@end 

답변

0

어때요?

ATMHud *blargh; 


if(loaded) 
{ 
blargh.hidden = YES; 
} 
+0

이 코드는 어디에 넣으시겠습니까? –

0

이 시도 :

- (void)webViewDidFinishLoad:(UIWebView *)webView 
{ 
// stop animating here 

} 

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error 
{ 
// stop animating here also 

} 

은 또한 당신의 "myWebView"예를 위임이 설정되어 있는지 확인합니다. Fe _myWebView.delegate = self;

+0

메모 외에 중괄호 안에 있어야 할 것이 있습니까? –

+0

올바른 코드 줄을 사용하여 답변을 업데이트했습니다 (델리게이트) – Injectios

+0

btw myWebView.delegate = self를 설정했습니다. ? – Injectios

관련 문제