美文网首页
tabbar 透明度

tabbar 透明度

作者: 叶舞清风 | 来源:发表于2019-06-02 20:33 被阅读0次
    #pragma mark ========= 修改tabbar 的高度
    - (void)viewDidLayoutSubviews{
    //      NSLog(@"%lf, %lf, %lf, %lf,", self.tabBar.frame.origin.x, self.tabBar.frame.origin.y, self.tabBar.frame.size.width, self.tabBar.frame.size.height);
        static dispatch_once_t onceToken;
        
        dispatch_once(&onceToken, ^{
            CGRect frame = CGRectMake(0, self.tabBar.frame.origin.y-41, self.tabBar.frame.size.width, 90);
            self.tabBar.frame = frame;
        });
    //    self.tabBar.backgroundColor = [UIColor clearColor];
        self.tabBar.backgroundImage = [self imageWithColor:[UIColor colorWithRed:1 green:1 blue:1 alpha:0]];
        
    }
    - (UIImage *)imageWithColor:(UIColor *)color
    {
        CGRect rect = CGRectMake(0.0f,0.0f, 1.0f,1.0f);
        UIGraphicsBeginImageContext(rect.size);
        CGContextRef context =UIGraphicsGetCurrentContext();
        CGContextSetFillColorWithColor(context, [color CGColor]);
        CGContextFillRect(context, rect);
        UIImage *image =UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return image;
    }
    
    

    相关文章

      网友评论

          本文标题:tabbar 透明度

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