UIViewに影を追加します。
[blurView.layer setCornerRadius:kCornerRadius];
blurView.layer.masksToBounds = NO;
blurView.layer.shadowColor = [[UIColor redColor] CGColor];
blurView.layer.backgroundColor = blurView.layer.shadowColor;
blurView.layer.shadowPath = [UIBezierPath
bezierPathWithRoundedRect:CGRectMake(-2.0*kCornerRadius, -2.0*kCornerRadius, blurView.bounds.size.width+4.0*kCornerRadius, blurView.bounds.size.height+4.0*kCornerRadius)
cornerRadius:kCornerRadius].CGPath;
blurView.layer.cornerRadius = kCornerRadius;
blurView.layer.shadowOffset = CGSizeMake(0.0, 0.0);
blurView.layer.shadowRadius = kCornerRadius;
blurView.layer.shadowOpacity = kOpacity;
blurView.layer.opacity = 1.0;
コードのこの部分は、uiviewがぼやけているように、このビューを提供します。
BlurView.layerの不透明度を(たとえば0.5に)変更しようとすると、予期しないビューが表示されます。
ご覧のとおり、uiviewの鋭いエッジが得られます。
影の不透明度はレイヤーの不透明度の一部だと思います。これがこの「エラー」の原因です。誰かが私がこれを修正するのを手伝ってもらえますか?BlurView.layerなどの不透明度を変更する前にレイヤーをマージできますか?
UPD
この修正により:blurView.layer.shadowColor = [[UIColor colorWithRed:1 green:0 blue:0 alpha:0.5] CGColor];
私はこれを手に入れます:
UPD
答えはsetShouldRasterizeメソッドを使用しています:
みんなありがとう!
[blurView.layer setShouldRasterize:YES];