在写内容过程中,把写内容过程中比较好的内容珍藏起来,下边内容内容是关于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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。