navigation设置渐变色

CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)[UIColor cyanColor].CGColor, (__bridge id)[UIColor blueColor].CGColor];
gradientLayer.locations = @[@(0), @(2)];
gradientLayer.startPoint = CGPointMake(0, 0);
gradientLayer.endPoint = CGPointMake(0, 1);
gradientLayer.frame = CGRectMake(0, -44, [UIScreen mainScreen].bounds.size.width, 88);
[nvc.navigationBar.layer addSublayer:gradientLayer];

你可能感兴趣的:(ios)