I very rarely override drawRect in my UIView subclasses, usually preferring to set layer.contents
with pre-rendering images and often employing multiple sublaye
In my case, there were two problems:
I did not implement initWithFrame
in custom view: (Usually initWithCoder:
is called when you initialize via IB, but for some reason initWithFrame:
is needed for IBDesignable
only. Is not called during runtime when you implement via IB)
My custom view's nib was loading from mainBundle
: [NSBundle bundleForClass:[self class]]
was needed.