iOS: Adding a drop shadow in an image

You can just modify the x,y and width and height values inside the CGRectMake to make adjustments for your object's relative coordinates and you can also adjust as well the radius, opacity and offset of the shadow.

Make sure your self.contentView is the view where your image is shown, and take note that your image must be added after the shadow, not before the shadow so it'll be behind the image.

By adding an image, just do after the code above somewhat like,

self.imageView = [[UIImageView alloc] initWithImage:[UIImage  imageNamed:@"CellImageTest.png"]];
[self.contentView addSubview:self.imageView];


Comments

Popular posts from this blog

Converting sectors into MB - Useful in understanding the sectors in iostat in Linux

What is Disk Contention?

Installing MySQL from source: Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)