i custom bwlabel draw label's border.
- (void)drawrect:(cgrect)rect { cgrect frame = self.frame; uibezierpath *linepath = [uibezierpath bezierpath]; [linepath movetopoint:cgpointmake(0,0)]; [linepath addlinetopoint:cgpointmake(frame.size.width, 0)]; [linepath addlinetopoint:cgpointmake(frame.size.width, frame.size.height)]; [linepath addlinetopoint:cgpointmake(0, frame.size.height)]; cashapelayer *linelayer = [cashapelayer layer]; linelayer.linewidth = 3.0f; linelayer.strokecolor = [[uicolor whitecolor] cgcolor]; linelayer.path = linepath.cgpath; [self.layer addsublayer:linelayer]; } i use debug view hierarchy see bwlabel. 
i have question, why cashapelayer not full?
your draw rect should this
- (void)drawrect:(cgrect)rect { cgrect frame = self.frame; uibezierpath *linepath = [uibezierpath bezierpath]; [linepath movetopoint:cgpointmake(0,0)]; [linepath addlinetopoint:cgpointmake(frame.size.width, 0)]; [linepath addlinetopoint:cgpointmake(frame.size.width, frame.size.height)]; [linepath addlinetopoint:cgpointmake(0, frame.size.height)]; [linepath addlinetopoint:cgpointmake(0, 0)]; cashapelayer *linelayer = [cashapelayer layer]; linelayer.linewidth = 3.0f; linelayer.strokecolor = [[uicolor whitecolor] cgcolor]; linelayer.path = linepath.cgpath; [self.layer addsublayer:linelayer]; }
Comments
Post a Comment