直播软件源码,实现导航栏全透明

发布时间 2023-09-13 14:11:12作者: 云豹科技-苏凌霄

直播软件源码,实现导航栏全透明

 

   [self.navigationController.navigationBarsetBackgroundImage:[selfimageWithColor:[UIColor clearColor]]
                       forBarPosition:UIBarPositionAny
                           barMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBarsetShadowImage:[UIImagenew]];
 
  
- (UIImage *)imageWithColor:(UIColor *)color
{
    // 描述矩形
    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    
    // 开启位图上下文
    UIGraphicsBeginImageContext(rect.size);
    // 获取位图上下文
    CGContextRef context =UIGraphicsGetCurrentContext();
    // 使用color演示填充上下文
    CGContextSetFillColorWithColor(context,[color CGColor]);
    // 渲染上下文
    CGContextFillRect(context, rect);
    // 从上下文中获取图片
    UIImage *theImage =UIGraphicsGetImageFromCurrentImageContext();
    // 结束上下文
    UIGraphicsEndImageContext();
    
    return theImage;
    
}

 以上就是直播软件源码,实现导航栏全透明, 更多内容欢迎关注之后的文章