iOS 知识点 - 前奏更新
漫长的不更新状态,最近加班到天昏地暗,今晚要熬个通宵:
其实吧,大部分的熬夜都无关努力,只是低效而已
网页内禁止复制粘贴
- 网页内禁止复制粘贴,这功能其实挺鸡肋的,但是有时候呢确实用得上,比如说你在手机App里放得用户协议条款,这些东西可能不允许(no why)用户复制粘贴,so
// 禁止用户复制粘贴
[_webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect=’none’;"];
// 禁止用户拨打电话
[_webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout=’none’;"];
UILabel识别html代码
NSString *htmlStr = @"<html><body> Some html string \n <font size=\"13\" color=\"red\">This is some text!</font> </body></html>";
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlStr dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
UILabel * myLabel = [[UILabel alloc]initWithFrame:CGRectMake(50, 200, 200, 40)];
myLabel.attributedText = attrStr;
[self.view addSubview:myLabel];
休息会,过会进行发版,下次再更新 ~