I want to make custom UIView with border. Here is my code:
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 4.0);
CGContextSetStrokeColorWithColor(context, [[UIColor blueColor] CGColor]);
CGContextAddRect(context, self.frame);
CGContextStrokePath(context);
}
And here is the result:
All three UIView on this picture is my custom view, but only big UIView have the border. I don't understand why others have no border. What is wrong?