So I just quickly wanted a StrikableTextField, subclass of UITextField,
with a "striked" property and a modified drawRect:
However even though I make sure it gets called and it does so, the drawing I do there has no effect. Very strange. I've absolutely no clue now, so I'm asking for your help.
Even more strange, even if I comment out the [super drawRect:rect], the view draws itself correctly. I've set the class in Interface Builder, yes, I tripled checked that.
Code:
- (void)drawRect:(CGRect)rect
{
// [super drawRect:rect];
if (striked) {
NSLog(@"now striking through");
[[UIColor redColor] set];
UIRectFill([self bounds]); // also doesn't draw
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(0, 0)];
[path addLineToPoint:CGPointMake(rect.size.width, rect.size.height)];
[path stroke];
}
}
grateful for any light on this