美文网首页
iOS设置导航栏颜色

iOS设置导航栏颜色

作者: William_ | 来源:发表于2017-12-11 14:07 被阅读2次

    self.navigationController.navigationBar.translucent=YES;

    UIColor*color = [UIColorclearColor];

    CGRectrect =CGRectMake(0,0,kWindowW,64);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRefcontext =UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, color.CGColor);

    CGContextFillRect(context, rect);

    UIImage*image =UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    [self.navigationController.navigationBarsetBackgroundImage:imageforBarMetrics:UIBarMetricsDefault];

    self.navigationController.navigationBar.clipsToBounds=YES;

    相关文章

      网友评论

          本文标题:iOS设置导航栏颜色

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