Last active
January 4, 2016 01:59
-
-
Save lvyile/8552322 to your computer and use it in GitHub Desktop.
UIWebView 禁止长按和选择 (Client/Server,2套方案)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - Client | |
#pragma mark UIWebViewDelegate | |
- (void)webViewDidFinishLoad:(UIWebView *)webView { | |
// Disable user selection | |
[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect='none';"]; | |
// Disable callout | |
[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout='none';"]; | |
} | |
#pragma mark - Web | |
//https://developer.apple.com/library/safari/samplecode/FingerTips/Listings/style_css.html | |
/* disable some default behaviors that would not fit nicely in a web app */ | |
// in css file, add this line: | |
// -webkit-touch-callout: none; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment