效果图如下所示:
直接上代码 //移除顶部线条 self.tabBar.backgroundImage = [UIImage new]; self.tabBar.shadowImage = [UIImage new]; //添加阴影 self.tabBar.layer.shadowColor = [UIColor lightGrayColor].CGColor; self.tabBar.layer.shadowOffset = CGSizeMake(0, -5); self.tabBar.layer.shadowOpacity = 0.3;