在MainTabBarController.m文件中寫入下面代碼:
// 重寫tabbar高度
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
CGRect frame = self.tabBar.frame;
frame.size.height = 55;
frame.origin.y = self.view.frame.size.height - frame.size.height;
self.tabBar.frame = frame;
self.tabBar.backgroundColor = [UIColor blackColor];
//此處需要設(shè)置barStyle际看,否則顏色會分成上下兩層
self.tabBar.barStyle = UIBarStyleBlack;
}