UIView shadow not working
问题 This is my code. listView.layer.masksToBounds = NO; listView.layer.shadowOffset = CGSizeMake(-3, 3); listView.layer.shadowColor=[[UIColor blackColor] CGColor]; listView.layer.shadowRadius = 4; listView.layer.shadowOpacity = 1.0; [listView.layer setShouldRasterize:YES]; It works good with shadow effect. While changing listView.layer.masksToBounds = YES; I didnt get shadow effect. 回答1: The shadow is actually drawn below the UIView. If you set maskToBounds to YES, this clips any drawing outside