The code for setting the level should be in the awakeFromNib method, and not in the initWithFrame function.
Explanation of why :)
In the nib file, your view is marked as not needing a layer, so the stream
- you set your layers in the initWithFrame method:
- The properties of the nib file are configured to clear your layers.
You can also leave your code as it is and tell the interface developer that your user view requires a layer.
source share