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

I can't pass some value from html checkbox array to my php page?

php javascript html mysql

I created the product management system that use HTML+PHP+SQL+JS.But it's have a problem

Running sql scripts against an attached database?

sql sql-server-express mdf

I've got an MDF attached to an instance of Sql Server 2008 Express, and I need to run some sql scripts against it to generate tables, indexes, etc.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.