2

I am developing an E-Commerce application. I need to show product list image in rounded corner with shadowOffset. Both are not working together & i have tried with lot of solution but no one is solved my problem. Any help will be appreciate one.

Updated Code :

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20,260,45,45)];
imageView.backgroundColor = [UIColor grayColor];
UIImage *image = [UIImage imageNamed:@"sample.png"];
imageView.image = image;

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:imageView.bounds
                                               byRoundingCorners:UIRectCornerAllCorners
                                                     cornerRadii:CGSizeMake(22.5, 22.5)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = imageView.bounds;
maskLayer.path = maskPath.CGPath;
[imageView.layer setMask:maskLayer];

[imageView.layer setShadowOffset:CGSizeMake(0, 3)];
[imageView.layer setShadowOpacity:0.4];
[imageView.layer setShadowRadius:3.0f];
[imageView.layer setCornerRadius:22.0f];
imageView.layer.shadowColor=[UIColor redColor].CGColor;
imageView.layer.borderColor=[UIColor blackColor].CGColor;
imageView.layer.borderWidth=1.0;
[self.view addSubview:imageView];

Thanks & Regards Sam.P

Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
MaheThiru
  • 137
  • 9

0 Answers0