您好,登錄后才能下訂單哦!
在寫內容過程中,把寫內容過程中比較好的內容珍藏起來,下邊內容內容是關于IOS系統中網絡等待的Loading的實現方法的內容,希望能對碼農有所幫助。
WebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 44, 320, 400)];
[WebView setUserInteractionEnabled:NO];
[WebView setBackgroundColor:[UIColor clearColor]];
[WebView setDelegate:self];
[WebView loadRequest:[NSURLRequest requestWithURL:url]];
[view setTag:103];
[view setBackgroundColor:[UIColor blackColor]];
[view setAlpha:0.8];
[self.view addSubview:view];
activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)];
[activityIndicator setCenter:view.center];
[activityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhite];
[view addSubview:activityIndicator];
[self.view addSubview:WebView];
[view release];
[WebView release];
[activityIndicator startAnimating];
}
[activityIndicator stopAnimating];
[view removeFromSuperview];
}
第二種方法:使用UIAlertViewandUIActivityIndicatorView
if (myAlert==nil){
myAlert = [[UIAlertView alloc] initWithTitle:nil
message: @"讀取中..."
delegate: self
cancelButtonTitle: nil
otherButtonTitles: nil];
activityView.frame = CGRectMake(120.f, 48.0f, 38.0f, 38.0f);
[myAlert addSubview:activityView];
[activityView startAnimating];
[myAlert show];
}
}
[myAlert dismissWithClickedButtonIndex:0 animated:YES];
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。