iOS吧

iOS View设置渐变色

2017-09-19  本文已影响17人  酒深巷子Ya
    _headView = [[UIView alloc] initWithFrame:CGRectMake(0, 64, _WIDTH, 200)];
    CAGradientLayer *viewALayer = [CAGradientLayer layer];
    viewALayer.frame = _headView.bounds;
    viewALayer.colors = [NSArray arrayWithObjects:
                       (id)[UIColor colorWithRed:49/255.0 green:202/255.0 blue:111/255.0 alpha:1.0].CGColor,
                       (id)[UIColor colorWithRed:123/255.0 green:222/255.0 blue:167/255.0 alpha:1.0].CGColor,
                       (id)[UIColor whiteColor].CGColor, nil];
    [_headView.layer addSublayer: viewALayer];
上一篇 下一篇

猜你喜欢

热点阅读