ios中webview的高级用法
.隐藏上下滚动时出边界的后面的黑色的阴影
- (void) hideGradientBackground:(UIView*)theView
{
for (UIView * subview in theView.subviews)
{
if ([subview isKindOfClass:[UIImageView class]])
subview.hidden = YES; [self hideGradientBackground:subview];
}
} . 禁用拖拽时的反弹效果
[(UIScrollView *)[[webView subviews] objectAtIndex:] setBounces:NO]; . 判断用户点击类型 - (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:];
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中webview的高级用法(二)
框架: webview与js的通信框架 #import "MJViewController.h" #import "MBProgressHUD+Add.h" ...
- 详解Vue中watch的高级用法
我们通过实例代码给大家分享了Vue中watch的高级用法,对此知识点有需要的朋友可以跟着学习下. 假设有如下代码: <div> <p>FullName: {{fullName} ...
- linux中find命令高级用法
前言 在<Linux中的文件查找技巧>一文中,我们已经知道了文件查找的基本方法,今天我们介绍find命令的一些高级使用技巧.它能满足我们一些更加复杂的需求. 查找空文件或空目录 有时候需要 ...
- IOS中WebView的使用
UIWebView是iOS sdk中一个最常用的控件.是内置的浏览器控件,我们可以用它来浏览网页.打开文档等等,UIWebView能够加载html/htm.pdf.docx.txt等格式的文件 系统 ...
- iOS中Block的基础用法
本文简介 本章不会对Block做过多的实现研究.只是讲解基本的用法.纯粹基础知识.结合实际项目怎么去做举例.Block使用场景,可以在两个界面的传值,也可以对代码封装作为参数的传递等.用过GCD就知道 ...
- iOS中webView加载URL需要处理特殊字符
今天在项目中遇到webView加载URL时,因为URL中有特殊字符,导致页面无法加载,而且在- (BOOL)webView:(UIWebView )webView shouldStartLoadWit ...
- SQL语句中的select高级用法
#转载请联系 为了更好的了解下面的知识点,我们先创建两张表并插入数据. # 学生表 +----+-----------+------+--------+--------+--------+------ ...
- ios中陀螺仪CoreMotion的用法
转自:http://code.eoe.cn/471/title/ios涓檧铻轰华CoreMotion鐨勭敤娉 README.md 外部引用 原始文档 以前在iphone中要得到加速度时,只能使用Ac ...
- Flutter 中渐变的高级用法
Flutter 中渐变有三种: LinearGradient:线性渐变 RadialGradient:放射状渐变 SweepGradient:扇形渐变 看下原图,下面的渐变都是在此图基础上完成. Li ...
随机推荐
- 用 Vue 改造 Bootstrap,渐进提升项目框架[转]
GitChat 作者:Meathill 原文:用 Vue 改造 Bootstrap,渐进提升项目框架 关注微信公众号:「GitChat 技术杂谈」 一本正经的讲技术 [不要错过文末彩蛋] 前言 Vue ...
- [leetcode]Best Time to Buy and Sell Stock II @ Python
原题地址:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/ 题意: Say you have an array ...
- Android -- Annotation
Override Annotation @Override public void onCreate(Bundle savedInstanceState){}; 概念 An annotation is ...
- Centos安装gcc及g++
Centos支持yum安装,安装软件一般格式为yum install .......,注意安装时要先成为root用户. 按照这个思路,我想安装过程如下: 安装gcc:yum install gcc 安 ...
- Visual stuido 项目路径的奇怪问题
从别人那里以zip的形式接受了一个solution, 然后在接收目录解压缩,然后剪切到其他的目录.此时报错,说找不到项目文件,看Visual studio 寻找的详细路径,发现它还是到解压缩的那个目录 ...
- innerWidth outerWidth
在jQuery中: 一.width()方法用于获得元素宽度: 二.innerWidth()方法用于获得包括内边界(padding)的元素宽度; 三.outerWidth()方法用于获得包括内边界(pa ...
- .NET 基于任务的异步模式(Task-based Asynchronous Pattern,TAP) async await
本文内容 概述 编写异步方法 异步程序中的控制流 API 异步方法 线程 异步和等待 返回类型和参数 参考资料 下载 Demo 下载 Demo TPL 与 APM 和 EAP 结合(APM 和 EAP ...
- 牛客网-《剑指offer》-包含min函数的栈
题目:http://www.nowcoder.com/practice/4c776177d2c04c2494f2555c9fcc1e49 辅助栈 C++ class Solution { public ...
- Linux shell中一些参数与变量简介
linux中shell变量$#,$@,$0,$1,$2,$!,$$,$*,$-,$@......等很多个,很容易记错,这里再次整理一下,相关含义解释如下,并附上一个实践截图. 多看几次,多用几次,应该 ...
- Java 判断Windows下某个进程是否运行
public static void main(String[] args) { String keyWord = "chrome.exe"; Runtime runtime = ...