UIView Background Color Always Black
问题 When I add a UIView to a View Controller programmatically I am not able to change the background color to any other color, it always remains black. - (void)drawRect:(CGRect)rect { // Drawing code self.backgroundColor = [UIColor blueColor]; UIBezierPath *path = [[UIBezierPath alloc] init]; [path moveToPoint:CGPointMake(100, 33)]; [path addLineToPoint:CGPointMake(200, 33)]; path.lineWidth = 5; [[UIColor redColor] setStroke]; [path stroke]; } When I comment drawrect: out and add self