harin
8/8/2013 - 5:05 AM

addeffect.mm

            NSString *imageName = [NSString stringWithFormat:@"profile%i%i.jpg", self.no/10, self.no%10];
            
            UIImage *image = [UIImage imageNamed:imageName];
            UIImageView *profileImage = [[UIImageView alloc] initWithImage:image];
            profileImage.frame = CGRectMake(0, 0, 55,55);
            [profileImage setContentMode:UIViewContentModeScaleAspectFill];
            
            // make new layer to contain shadow and masked image
            CALayer* containerLayer = [CALayer layer];
            containerLayer.shadowColor = [UIColor blackColor].CGColor;
            containerLayer.shadowRadius = 2.f;
            containerLayer.shadowOffset = CGSizeMake(0.5f, 2.f);
            containerLayer.shadowOpacity = 0.2f;
            
            // add masked image layer into container layer so that it's shadowed
            [containerLayer addSublayer:profileImage.layer];
            
            //    profileImage.frame = CGRectMake(10, 5, 56, 56);
            profileImage.layer.cornerRadius = roundf(profileImage.frame.size.width/2.0);
            profileImage.layer.borderColor = [[UIColor whiteColor] CGColor];
            profileImage.layer.borderWidth = 2.5f;
            profileImage.layer.masksToBounds = YES;