objective c - iOS: Draw clear circle with UIBezierPath bezierPathWithOvalInRect: -


in uitableviewcontroller's cells, want display circle number in it. using uibezierpath's bezierpathwithovalinrect: draw circle.

unfortunately, while can set fill color clearcolor, unused portion of cgrect passed bezierpathwithovalinrect: black.

how rid of black area created?

partial screenshot reference:
screenshot
(i hope number inside circle)

code:

ltttableviewcell:

- (void)awakefromnib {     [super awakefromnib];      // create square view using height of cell     cgrect positionframe = cgrectmake(0, 0, self.bounds.size.height, self.bounds.size.height);     lttdrawballview *drawballview = [[lttdrawballview alloc] initwithframe:positionframe];     [self.contentview addsubview:drawballview]; } 

lttdrawballview:

- (void)drawrect:(cgrect)rect {     // create new rect padding       // + create circle new rect:     cgrect box = cgrectinset(self.bounds, self.bounds.size.width * 0.1f, self.bounds.size.height * 0.1f);     uibezierpath *ballbezierpath = [uibezierpath bezierpathwithovalinrect:box];     [[uicolor whitecolor] setstroke];     [[uicolor greencolor] setfill]; // green here show black area     [ballbezierpath stroke];     [ballbezierpath fill];     [self setbackgroundcolor:[uicolor clearcolor]]; // happens , without line } 

in init method of lttdrawballview, include code:

self.opaque = no; self.backgroundcolor = [uicolor clearcolor]; 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -