OC-悬浮UITabBarController效果

a6800fbb-6a0e-4361-8f10-9e5d75d63680.png
TabBarVC *tabBarController = [[TabBarVC alloc]init];
[UIApplication sharedApplication].keyWindow.rootViewController = tabBarController;
[[UIApplication sharedApplication].keyWindow makeKeyAndVisible];
//关键代码
tabBarController.additionalSafeAreaInsets = UIEdgeInsetsMake(0, 0, 15, 0);// 在底部增加15点外边距
CAShapeLayer *mapBorder = [[CAShapeLayer alloc] init];
mapBorder.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(10, 0, SCREEN_WIDTH-20, 55) byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(30, 30)].CGPath;
tabBarController.tabBar.layer.mask = mapBorder;

//调UITabBar的图与文字位置方法
    //title上移
[childVC.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0,y)];
    //image上移
 childVC.tabBarItem.imageInsets = UIEdgeInsetsMake(0, 0, -15, 0);
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容