問題:
項(xiàng)目中有2個(gè)UITabBarController來回切換,并且都帶有陰影效果。
首先是我自己添加了一個(gè)白色的UIView,設(shè)置了陰影效果,UITabBarController確實(shí)有了陰影效果,但是在2個(gè)UITabBarController來回切換的過程中,我發(fā)現(xiàn)陰影效果會(huì)加重。
解決辦法(直接上代碼):
1.去掉UITabBarController上面的黑色線條
self.tabBar.barStyle = UIBarStyleBlack;
2.設(shè)置UITabBarController的顏色
[UITabBar appearance].translucent = NO;
[[UITabBar appearance] setBarTintColor:[UIColor whiteColor]];
3.設(shè)置陰影
self.tabBar.layer.shadowColor = [UIColor lightGrayColor].CGColor;
self.tabBar.layer.shadowOffset = CGSizeMake(0, -1);
self.tabBar.layer.shadowOpacity =0.3;
OK,這樣就可以解決上面項(xiàng)目中的切換陰影加重的問題。