禁用在UIWebView中复制和粘贴未解决 [英] Disable copy and paste in UIWebView unsolved

查看:243
本文介绍了禁用在UIWebView中复制和粘贴未解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几乎,我试过每一件事情禁用复制/粘贴在 UIWebView ,但没有什么工作与我。



im从字符串(字符串数组)加载我的 UIWebView 如下:

  [webView loadHTMLString:
[NSString stringWithFormat:@%@< p class = \paragraph\style = \float:right\>%@< / p> ;,css,[[array objectAtIndex:0] valueForKey:@content]] baseURL:nil];

我试过这个:

   - (void)webViewDidFinishLoad:(UIWebView *)webView1 {
[webView1 stringByEvaluatingJavaScriptFromString:@document.body.style.webkitUserSelect ='none';];
}

并且:

  NSString * css = 
@< head>< style>< body> * { - webkit-touch-callout:none; -webkit- :none;}< / style>< / head>< / body>;

但是没有什么与我有关的工作
特别是对于iOS 4.2
任何想法?

解决方案

  -webkit-user-select:none; / *禁用选择/复制UIWebView * / 

也将禁用Mobile Safari上的表单。 >

Nearly , i had tried every thing to disable copy/paste in UIWebView but nothing worked with me.

im loading my UIWebView from a string (array of strings) as follows:

[webView loadHTMLString:
[NSString stringWithFormat:@"%@<p class=\"paragraph\"  style=\"float: right\"  >%@</p>",css,[[array objectAtIndex:0] valueForKey:@"content"]]   baseURL:nil ];

i had tried this :

-(void)webViewDidFinishLoad:(UIWebView *)webView1{
[webView1 stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitUserSelect='none';"];
}

and this:

  NSString *css =
@"<head><style><body> *{-webkit-touch-callout: none; -webkit-user-select: none;}</style> </head>  </body> ";

but nothing worked with me especially for iOS 4.2 any ideas ??

解决方案

-webkit-user-select: none; /* Disable selection/Copy of UIWebView */

will also disable form on Mobile Safari.

这篇关于禁用在UIWebView中复制和粘贴未解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆