I have a UIView-derived view that is drawn only once and never updated.
Calling [self setNeedsDisplay]
has no effect. What could cause this?
It doesn't matter whether the drawing code is in
drawRect:
, ordrawLayer:inContext:
(with an empty drawRect() defined)
If drawLayer:inContext is not defined, then drawRect is called. But just once (during layout).
- (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)ctx {
// drawing occurs, but just once (during view layout)
}
`- (void)drawRect:(CGRect) rect {
// empty -- never called
}
A small list of what I've tried:
- [self setNeedsDisplay]
- [self.layer setNeedsDisplay]
- [self.mySubLayer setNeedsDisplay]
- self.contentMode = UIViewContentModeRedraw;
- creating the view manually, instead of loading it from a .nib (no effect)
- Removing the use of layers (and sublayers) and using just drawRect (no effect)