I know there are similar questions out there, but haven't found an answer that has helped me resolve my issue. If you've seen one, feel free to mark this as duplicate, but please make sure it answers the entire question and not just similar parts.
I have a UIImageView, and I am rounding the corners and adding a border to it. However, I'm starting to add some drop shadows to give my UI some depth. I'm adding a shadow to my profile picture, and the following code works great for a perfectly square image, which gets cropped into a perfect circle. However, for non-square rectangular images, the shadow is applied to the image itself rather than the image view, so I end up with a round border around a cropped rectangular image, which has a shadow around the edges that don't reach the circular border. Any insight into how I can modify my code to apply this shadow to be around the border, instead of the image within the UIImageView?
Thanks
//Set profile image view to be rounded (default appears rounded due to alpha background, need rest to appear rounded as well
[self.profileImageView layoutIfNeeded];
CALayer *imageLayer = self.profileImageView.layer;
[imageLayer setCornerRadius:self.profileImageView.frame.size.width/2];
[imageLayer setBorderWidth:1];
[imageLayer setBorderColor:[[UIColor colorWithRed:78.0/255.0 green:82.0/255.0 blue:85.0/255.0 alpha:1] CGColor] ];
[imageLayer setMasksToBounds:YES];
//Apply shadows to necessary views for the job badge
[self.profileImageView.layer setShadowColor:[[UIColor blackColor] CGColor]];
[self.profileImageView.layer setShadowRadius:4.0f];
[self.profileImageView.layer setShadowOffset:CGSizeMake(0, -3)];
[self.profileImageView.layer setShadowOpacity:0.5f];