Apply a shadow to an array of UIImageView

I have an array of UIImageViews. I want to apply a shadow to each of these images. I've used the code below:

- (void)awakeFromNib {
    for (UIImageView *image in imagesJigsawPieces) {
        image.layer.shadowColor = [UIColor blackColor].CGColor;
        image.layer.shadowOffset = CGSizeMake(-1, -1);
        image.layer.shadowOpacity = 1;
        image.layer.shadowRadius = 5.0;
        image.clipsToBounds = NO; //EDIT: I have also included this with no change
    }
}

I have also included #import <QuartzCore/CALayer.h>.

I am not getting any errors but I am also not getting any shadows on my images.

Answers


Are you certain this code is being called? Have you placed a breakpoint in the for loop to verify?

-awakeFromNib is called only if you have a view (or whatever) in a nib file connected via IBOutlet to an ivar in your code. -awakefFromNib is called, in this case, instead of -initWithFrame: (or the like), an important distinction which I sometimes forget myself!


Need Your Help

Puzzle Solver - Determining what variables belong together based on given facts & constraints by calculating probabilities

python loops time probability python-3.2

Before I say anything else - the problem may look lengthy but it's actually just 1 problem in the core, that kind of gets repeated. I'm trying to create a "puzzle solver" that has to do with