iPhone How to set a clearcolor for my custom view

Posted by user355066 on Stack Overflow See other posts from Stack Overflow or by user355066
Published on 2010-06-01T05:00:21Z Indexed on 2010/06/01 5:03 UTC
Read the original article Hit count: 219

Filed under:
|

Hi, I am creating a custom StyleLabel by extending the UIView, which provides a link for particular type of strings. I have successfully implemented this functionality.

I am using this label in TableViewCell along with UILabel.i set UILabel & StyleLabel background color is set to clearColor. UILabel works fine, but StyleLabel shows background in blackColor.

I am not sure what is the problem with the following code.

Here is the drawRect method of CustomLabel class

-(void) drawRect:(CGRect)rect 
{
     CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextClearRect(ctx, rect);
    [[UIColor clearColor] setFill];
    CGContextAddRect(ctx, rect);
    CGContextDrawPath(ctx, kCGPathFill);
    [_text drawText:ctx];

}

Thanks Sasikumar

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk