1 、自适应高度的时候计算高度
CGSize labelSize = [labelTextsizeWithFont:[UIFontsystemFontOfSize:fontSize]
constrainedToSize:CGSizeMake(frame.size.width,10000)
lineBreakMode:NSLineBreakByTruncatingTail];
注:如果想得到高度的话,应该将size的高度设为一个很大的值
2 自绘一张纯色图片 (无边框的)
+ (UIImage *)imageWithColor:(UIColor *)color bound:(CGRect)bound
{
UIGraphicsBeginImageContext(bound.size);
CGContextRef context =UIGraphicsGetCurrentContext();
//填充颜色为xxse
CGContextSetFillColorWithColor(context, [colorCGColor]);
//在context上绘制
CGContextFillRect(context, bound);
//把当前context的内容输出成一个UIImage图片
UIImage *image =UIGraphicsGetImageFromCurrentImageContext();
//上下文栈pop出创建的context
UIGraphicsEndImageContext();
return image;
}
参考 http://www.tuicool.com/articles/jIJzMf
http://blog.csdn.net/zhangkongzhongyun/article/details/9214369
创建一个基于位图的上下文(context),并将其设置为当前上下文,
文档中说:系统会维护一个CGContextRef 的栈,而UIGraphicsGetCurrentContext()会取栈顶的CGContextRef
CGContextRef context = UIGraphicsGetCurrentContext(); 获取图形上下文
CGContextSetFillColorWithColor(context, [colorCGColor]);// 这个方法使用来填充矩形的。
CGContextFillRect(context, bound);//用来限制填充矩形的边界
fireeye 的攻击检测网址: https://www.fireeye.com/cyber-map/threat-map.html
在这里可以看到全球正在发生的黑客攻击行为
二、webview加载内存暴增的问题
ios8出了一个WKWebView 但是ios7用不了,有人写了可兼容的方法:参考IMYWebView
三、一个有意思的网站 ,可以自动画出函数曲线https://www.desmos.com/calculator