UIWebViewがまだページを読み込んでいる限り、カスタム読み込み用の.gifや別のイメージを表示する簡単な方法を探しています。ロード中にUIWebViewに読み込み用のGIFを設定する
は私が
– webViewDidStartLoad:(UIWebView *)webView
でそれをしなければならない知っているが、どのように、私はイメージをロードしていますか?
UIWebViewがまだページを読み込んでいる限り、カスタム読み込み用の.gifや別のイメージを表示する簡単な方法を探しています。ロード中にUIWebViewに読み込み用のGIFを設定する
は私が
– webViewDidStartLoad:(UIWebView *)webView
でそれをしなければならない知っているが、どのように、私はイメージをロードしていますか?
これを試してみてください。
– webViewDidStartLoad:(UIWebView *)webView {
UIImageView *animatedImages;
NSMutableArray *imageArray;
// Array to hold jpg images
imageArray = [[NSMutableArray alloc] initWithCapacity:IMAGE_COUNT];
// Build array of images, cycling through image names
for (int i = 0; i < IMAGE_COUNT; i++)
[imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"yourGifImage%d.jpg", i]]];
// Animated images - centered on screen
animatedImages = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,IMG_HEIGHT,IMG_WIDTH)];
animatedImages.center = self.webView.center;
animatedImages.animationImages = [NSArray arrayWithArray:imageArray];
// One cycle through all the images takes 1 seconds
animatedImages.animationDuration = 1.0;
// Repeat forever
animatedImages.animationRepeatCount = 0;
animatedImages.tag = 1;
[animatedImages startAnimating];
// Add to webview
[self.webView addSubview:animatedImages];
}
とwebViewDidFinishLoad:
方法でスーパー
- (void)webViewDidFinishLoad:(UIWebView *)webView {
UIView * removeAminatingImages = [self.webView viewWithTag:1];
[removeAminatingImages removeFromSuperview];
}
これはアニメーション画像の面白い実装ですが、より適しているのはUIActivityViewです – Daniel
なぜ画像が.lpgで終わるのか教えてください。そして、私はgngのすべてのフレームをpngとして取るのですか? – spankmaster79
@spankmasterそれはちょうど間違いを入力していた私はそれを編集した – Gyani
からそれを削除するには、UIActivityViewを使用することができますので、正確に何が、GIFのですか? –