1.画图片
- (void)drawRect:(CGRect)rect {
// Drawing code UIImage *image = [UIImage imageNamed:@"papa"]; // 在这个点画
[image drawAtPoint:CGPointZero];
// 指定一个区域
[image drawInRect:CGRectMake(, , , )];
// 在这个范围平铺
[image drawAsPatternInRect:CGRectMake(, , , )];
}
2.画文字
-(void)drawText{
NSString *text = @"quartz2D入门"; //[text drawAtPoint:CGPointZero withAttributes:nil]; NSDictionary *att = @{NSFontAttributeName:[UIFont systemFontOfSize:],NSForegroundColorAttributeName:[UIColor redColor]}; [text drawInRect:CGRectMake(, , , ) withAttributes:att]; }