摘要: 1、新建ViewBasedApplication2、添加一个新的objective-c class,并设置为UIView的子类,可以命名为MyView3、重写MyView的方法- (void)drawRect:(CGRect)rect这个方法是在MyView里定义的,重写这个方法可以显示自己重绘的内容在方法内,添加以下代码,实现渐变颜色CGContextRef context = UIGraphicsGetCurrentContext(); CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); CGFloat colors[] = { 204 阅读全文
posted @ 2012-03-24 18:29 袁晓平 阅读(2408) 评论(0) 推荐(0) 编辑
摘要: 0CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文 1 CGContextMoveToPoint 开始画线 2 CGContextAddLineToPoint 画直线 4 CGContextAddEllipseInRect 画一椭圆 4 CGContextSetLineCap 设置线条终点形状 4 CGContextSetLineDash 画虚线 4 CGContextAddRect 画一方框 4 CGContextStrokeRect 指定矩形 4 CGContextStrokeRectWithWidth 指定矩形线宽度. 阅读全文
posted @ 2012-03-24 18:20 袁晓平 阅读(2455) 评论(0) 推荐(0) 编辑