// // ScannerView.m // CodeScanner // // Created by Ray on 14-7-24. // Copyright (c) 2014年 Shinobi Controls. All rights reserved. // #import "ScannerControllerView.h" @implementation ScannerControllerView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { CGContextRef con = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(con, [[UIColor colorWithRed:0 green:0 blue:0 alpha:0.5] CGColor]); CGContextFillRect(con, rect); //CGRect frame =CGRectMake(100,100,300,300); CGContextClearRect(con, self.highLightRect); // Drawing code // CGRect frame = self.contentView.frame; // // CGContextAddRect(context,frame); CGContextSetLineWidth(con, 1.0); // CGContextSetStrokeColorWithColor(con, [[UIColor redColor] CGColor]); // // CGRect selrect = self.highLightRect; CGContextMoveToPoint(con, self.highLightRect.origin.x, self.highLightRect.origin.y+ self.highLightRect.size.height/2.0); CGContextAddLineToPoint(con, self.highLightRect.origin.x+ self.highLightRect.size.width, self.highLightRect.origin.y+self.highLightRect.size.height/2.0); // CGContextStrokePath(con); [super drawRect:rect]; } @end