What is strange, I use a lot of custom materials, which I change and call "[self setNeedsLayout]", and I never had to call "layoutIfNeeded" ...
Are you sure your drawRect is fine and has no problems? Perhaps its data is not ready before you call "setNeedsLayout".
The first answer to the next thread may help you.
source share