美文网首页
设置Label,左右模糊效果

设置Label,左右模糊效果

作者: LeeDev | 来源:发表于2017-08-11 16:30 被阅读13次

用到 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

相关文章

网友评论

      本文标题:设置Label,左右模糊效果

      本文链接:https://www.haomeiwen.com/subject/lehrrxtx.html