// // LineView.m // Apex Mobile // // Created by Ray on 14-3-21. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved. // #import "LineView.h" @implementation LineView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); // CGRect frame = self.contentView.frame; // CGContextAddRect(context,frame); if(self.linewidth==0) self.linewidth=0.5; CGContextSetLineWidth(context, 0.5); if(self.linecolor==nil) self.linecolor = [UIColor lightGrayColor]; CGContextSetStrokeColorWithColor(context, [self.linecolor CGColor]/*[[UIColor colorWithRed:0.10 green:0.68 blue:0.94 alpha:0.7] CGColor]*/); // CGRect selrect = self.bounds; CGContextMoveToPoint(context, self.bounds.size.width*0.4, self.bounds.origin.y); CGContextAddLineToPoint(context, self.bounds.size.width*0.4, self.bounds.size.height); // CGContextStrokePath(context); CGContextMoveToPoint(context, self.linewidth/2, self.bounds.origin.y); CGContextAddLineToPoint(context, self.linewidth/2, self.bounds.size.height); CGContextMoveToPoint(context, self.bounds.size.width-self.linewidth/2, self.bounds.origin.y); CGContextAddLineToPoint(context, self.bounds.size.width-self.linewidth/2, self.bounds.size.height); CGContextStrokePath(context); [super drawRect:rect]; } @end