I have created a tableviewcell in XIB and used it in tableview using registering the class. I am using autolayout here.
But the problem is when i loading the tableview in viewcontroller the shadow of the view inside the cell is not setting correctly. it exceeds its bounds as i shown in picture with red box. 
But when is scrolling the tableview then the shadow of the view is shown correctly as expected.
The code used in cellForRowAtIndexPath is shown below:
let layer = cell.cellContectView.layer
layer.shadowOffset = CGSizeMake(1.0, 1.0)
layer.shadowColor = UIColor.blackColor().CGColor
layer.shadowRadius = 5
layer.shadowOpacity = 0.2
layer.masksToBounds = false
layer.shadowPath = UIBezierPath(rect: layer.bounds).CGPath
Please note: the blurred text is not an issue. Its hidden for security reason