用到
CAGradientLayer
来作为Label
的mask
CAGradientLayer *l = [CAGradientLayer layer];
l.frame = self.titleView.bounds;
l.colors = [NSArray arrayWithObjects:(id)[UIColor clearColor].CGColor, (id)[UIColor whiteColor].CGColor, (id)[UIColor clearColor].CGColor, nil];
l.startPoint = CGPointMake(0.0f, 0.5f);
l.endPoint = CGPointMake(1.0f, 0.5f);
self.titleView.layer.mask = l;
设置左右模糊效果.png
网友评论