UIImageView實現(xiàn)陰影處理
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 50, 50)];;
? ? imageView.backgroundColor = [UIColor whiteColor];
? ? //添加邊框
? ? CALayer * layer = [imageView layer];
? ? layer.borderColor = [[UIColor yellowColor] CGColor];
? ? layer.borderWidth = 5.0f;
? ? //添加四個邊陰影
? ? imageView.layer.shadowColor = [UIColor redColor].CGColor;
? ? imageView.layer.shadowOffset = CGSizeMake(0, 0);
? ? imageView.layer.shadowOpacity = 0.5;
? ? imageView.layer.shadowRadius = 3;
? ? //添加兩個邊陰影
? ? imageView.layer.shadowColor = [UIColor redColor].CGColor;
? ? imageView.layer.shadowOffset = CGSizeMake(10, 1);
? ? imageView.layer.shadowOpacity = 0.5;
? ? imageView.layer.shadowRadius = 2.0;
? ? [self.view addSubview:imageView];