ios中webview的高级用法
2013-07-08 17:31
381 查看
1.隐藏上下滚动时出边界的后面的黑色的阴影 - (void) hideGradientBackground:(UIView*)theView { for (UIView * subview in theView.subviews) { if ([subview isKindOfClass:[UIImageView class]]) subview.hidden = YES; [self hideGradientBackground:subview]; } } 2. 禁用拖拽时的反弹效果 [(UIScrollView *)[[webView subviews] objectAtIndex:0] setBounces:NO]; 3. 判断用户点击类型 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { switch (navigationType) { //点击连接 case UIWebViewNavigationTypeLinkClicked: { NSLog(@"clicked"); } break; //提交表单 case UIWebViewNavigationTypeFormSubmitted: { NSLog(@"submitted"); } default: break; } return YES; }
#import "BaseViewController.h" @interface BaseViewController () { UIWebView *webview; } @end @implementation BaseViewController #pragma mark -life cicry - (void)viewDidLoad { [super viewDidLoad]; webview=[[UIWebView alloc] initWithFrame:self.view.bounds]; webview.delegate=self;//因为这个代理设置的self [self.view addSubview:webview]; [webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.requestUrl]]]; [webview release]; UIScrollView *scollview=(UIScrollView *)[[webview subviews]objectAtIndex:0]; scollview.bounces=NO; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(void)viewDidUnload{ [super viewDidUnload]; self.requestUrl=nil; } - (void)dealloc { [_requestUrl release]; [super dealloc]; }
相关文章推荐
- ios中webview的高级用法
- iOS 基于JavaScriptCore 不等webView加载完毕就交互,网页获取原生内容。 webView的高级用法之JS交互,js与oc的相互调用
- ios中webview的高级用法(二)
- ios中webview的高级用法(二)
- ios中webview的高级用法(二)
- iOS webView的高级用法之JS交互
- ios中webview的高级用法(二) - webview与js的通信框架
- iOS webView的高级用法之JS交互,js与oc的相互调用(JavaScriptCore)
- ios中webview的高级用法(二)
- ios中webview的高级用法
- 【IOS开发】webView的用法
- android webView 的常见问题与高级用法
- iOS WebView的用法
- iOS webView 小用法
- 从h5网站页面跳转到微信小程序——微信web-view高级用法9
- iOS 中webView加载高级操作
- iOS中原生APP与JS交互 之 WebViewJavascriptBridge 的简单用法
- iOS webView的一些用法
- web-view h5页面传递参数给小程序,小程序接收h5网页传过来的数据——微信web-view高级用法10
- iOS 基于WebView浏览器的高级开发 (一)