I'm trying to add a shadow to a subview of a custom UITableViewCell. The subview serves as the visible background of the cell (the root view of the cell is clear).
The cell is laid out in the interface builder using a xib. The subview is laid out using autolayout constraints to the 4 edges of the cell.
For different width devices, the subview itself seems to autoresize fine. From stack overflow research I figured that I have to put my frame-dependent code in layoutSubviews method. I put my shadow drawing code there:
layer.shadowPath = [[UIBezierPath bezierPathWithRoundedRect:subView.bounds cornerRadius:3.0]CGPath];
the shadow appears, but only to the size of the frame before it is resized, which after some debugging seems to be the view frame rectangle, a modifiable constant in interface builder (that is actually grayed out for autolayout view controllers :@).
From further debugging it appears that the subview frame is never updated, even though the cell view frame is.(this was performed by printing the width of the view's frame in layoutSubviews)
layoutSubviewscalled, parent view frame size: 180 subview frame size: 148.000000
layoutSubviewscalled, parent view frame size: 375 subview frame size: 148.000000
is this a bug? Am I missing something? What can I do to reprimand this?