WEB开发网
开发学院手机开发iPhone 开发 iphone上如何绘制点状图 阅读

iphone上如何绘制点状图

 2010-10-19 20:45:23 来源:WEB开发网   
核心提示:027 dataSourceAfterPorcess = [[NSMutableArray alloc] init];028 ballImage =[UIImage imageNamed:@"cir2.png"];029 self.backgroundColor = [UIColor clearCo

027 dataSourceAfterPorcess = [[NSMutableArray alloc] init];

028 ballImage =[UIImage imageNamed:@"cir2.png"];

029 self.backgroundColor = [UIColor clearColor];

030 }

031 return self;

032}

033

034

035

036- (void)drawRect:(CGRect)rect {

037 // Drawing code

038 CGContextRef context = UIGraphicsGetCurrentContext();

039 CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);

040 CGContextFillRect(context, rect);

041 [@"nihao" drawAtPoint:CGPointMake(40, 60) withFont:[UIFont systemFontOfSize:12]];

042 [self calcScale:rect];

043 [self drawScale:context rect:rect];

044

045}

046

047

048-(void)drawScale:(CGContextRef)context rect:(CGRect)_rect

049{

050 CGPoint points[3];

051 points[0] = CGPointMake(MARGIN_LEFTSIDE-10, MARGIN_TOP_SIDE);

052 points[1] = CGPointMake(MARGIN_LEFTSIDE-10, _rect.size.height-MARGIN_BOTTOM_SIDE+1);

053 points[2] = CGPointMake(_rect.size.width-10, _rect.size.height-MARGIN_BOTTOM_SIDE+1);

054 CGContextSetAllowsAntialiasing(context, NO);

055 CGContextAddLines(context, points, 3);

056

057 points[0] = CGPointMake(MARGIN_LEFTSIDE-16, MARGIN_TOP_SIDE+5);

058 points[1] = CGPointMake(MARGIN_LEFTSIDE-10, MARGIN_TOP_SIDE);

059 points[2] = CGPointMake(MARGIN_LEFTSIDE-4, MARGIN_TOP_SIDE+5);

060 CGContextSetAllowsAntialiasing(context, NO);

061 CGContextSetLineWidth(context,1);

062 CGContextAddLines(context, points, 3);

063

064

065 points[0] = CGPointMake(_rect.size.width-16, _rect.size.height-MARGIN_BOTTOM_SIDE+7);

066 points[1] = CGPointMake(_rect.size.width-10, _rect.size.height-MARGIN_BOTTOM_SIDE+1);

上一页  1 2 3 4 5  下一页

Tags:iphone 如何 绘制

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接