#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;
}
网友评论