多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. UIWebView * webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 20, ScreenWidth, ScreenHeight-20)]; // 自动队页面进行缩放以适应屏幕 webView.scalesPageToFit = YES; webView.userInteractionEnabled = YES; webView.opaque = YES; [self.view addSubview:webView]; NSURL * url = [NSURL URLWithString:@"http://www.youku.com"]; NSURLRequest * request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request]; // NSString * myHT = @"优酷"; // [webView loadHTMLString:myHT baseURL:url]; /* [webView goBack]; // 返回 [webView goForward]; // 前往 [webView reload]; [webView stopLoading]; */ webView.delegate = self; //移除滚动后的外边阴影 UIScrollView *scrollView = webView.scrollView; for (int i = 0; i < scrollView.subviews.count ; i++) { UIView *view = [scrollView.subviews objectAtIndex:i]; if ([view isKindOfClass:[UIImageView class]]) { view.hidden = YES ; } } } #pragma mark - UIWebViewDelegate - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ /** * typedef NS_ENUM(NSInteger, UIWebViewNavigationType) { * UIWebViewNavigationTypeLinkClicked, * UIWebViewNavigationTypeFormSubmitted, * UIWebViewNavigationTypeBackForward, * UIWebViewNavigationTypeReload, * UIWebViewNavigationTypeFormResubmitted, * UIWebViewNavigationTypeOther }; */ NSLOG_FUNCTION; return YES; } // 开始加载 - (void)webViewDidStartLoad:(UIWebView *)webView{ NSLOG_FUNCTION; } // 完成加载 - (void)webViewDidFinishLoad:(UIWebView *)webView{ NSLOG_FUNCTION; } // 加载失败,弹出错误提示 - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ UIAlertView *alterview = [[UIAlertView alloc] initWithTitle:@"" message:[error localizedDescription] delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; [alterview show]; [alterview release]; NSLOG_FUNCTION; } ~~~