[英]iOS:How to add shadow to`tabbar`?
我有一个测试添加阴影,我tabbar
,但它没有显示出use.My代码如下:
_button.layer.shadowColor = [UIColor grayColor].CGColor;
_button.layer.shadowOffset = CGSizeMake(4,4);
_button.layer.shadowOpacity = 0.8;
_button.layer.shadowRadius = 4;
/* remove tab-line */
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
[self.tabBarController.tabBar setClipsToBounds:YES];
self.tabBarController.tabBar.layer.shadowColor = [UIColor grayColor].CGColor;
self.tabBarController.tabBar.layer.shadowOffset = CGSizeMake(0,-4);
self.tabBarController.tabBar.layer.shadowOpacity = 0.8;
self.tabBarController.tabBar.layer.shadowRadius = 4;
我还拍了张照片以表明:
创建带有阴影的图像,然后按以下步骤使用。
[[UITabBar appearance] setBackgroundImage:[[UIImage alloc] INITWITHYOURCUSTOMIMAGE]];
[[UITabBar appearance] setShadowImage:[[UIImage alloc] INITWITHYOURCUSTOMIMAGE]];
迅速:
UITabBar.appearance().shadowImage = UIImage(named:"YOURIMAGE")
UITabBar.appearance().backgroundImage = UIImage(named:"YOURIMAGE")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.