/**
* 画文字
*
* @param rect <#rect description#>
*/
- (void)drawRect:(CGRect)rect {
NSString *text = @"房价阿里价格的感觉啊;栏杆机;第三个哭敬爱个;惊呆了噶舒服发的撒个";
CGRect rt = CGRectMake(50.0,0.0, 100, 100);
// 获取上下文
CGContextRef ctf = UIGraphicsGetCurrentContext();
// 绘图
CGContextAddRect(ctf, rt);
// 渲染
CGContextStrokePath(ctf);
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setValue:[UIColor greenColor] forKey:NSForegroundColorAttributeName];
//dict[NSForegroundColorAttributeName] = [UIColor redColor];
dict[NSBackgroundColorAttributeName] = [UIColor whiteColor];
dict[NSFontAttributeName] = [UIFont systemFontOfSize:14];
// ios7.0
[text drawInRect:rt withAttributes:dict];
}
/**
* 画图片
*
* @param rect <#rect description#>
*/
- (void)drawRect:(CGRect)rect
{
UIImage *image = [UIImageimageNamed:@"92AE1EE8-0B99-4F28-8B81-66B18E9A0001"];
// [image drawAsPatternInRect:rect]; //平铺,大小不变
// [image drawInRect:rect];// 拉伸图片
[image drawAtPoint:CGPointMake(10,20)]; // 从一个点画,大小不变
}