底部凸起效果的功能实现方法多种多样,我为大家带来一种简便的方法
1.继承UITabBarController
#import "RootViewController.h"
#import "Customer_UITabBar.h"
/*视图宽高*/
#define WY_SCREENWIDTH [UIScreen mainScreen].bounds.size.width
#define WY_SCREENHEIGHT [UIScreen mainScreen].bounds.size.height
@interface RootViewController ()<CustomerTabBarDelegate>
@property (nonatomic, strong) NSMutableArray *childVCTitleArray;
@property (nonatomic, strong) NSMutableArray *childVCArray;
@property (nonatomic, strong) Customer_UITabBar *wyTabbar;
@end
@implementation RootViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//去掉白线
[[UITabBar appearance] setShadowImage:[UIImage new]];
[[UITabBar appearance]setBackgroundImage:[UIImage new]];
//添加子控制器
[self addChild];
[self.tabBar addSubview:self.wyTabbar];
self.wyTabbar.titleArray = self.childVCTitleArray;
self.selectedIndex = 2;
}
-(Customer_UITabBar *)wyTabbar
{
if (!_wyTabbar)
{
_wyTabbar = [[Customer_UITabBar alloc]initWithFrame:CGRectMake(0, -10, WY_SCREENWIDTH, 59)];
_wyTabbar.delegate = self;
}
return _wyTabbar;
}
//将图片名字和底