我在iOS应用中使用UITabBarController。上图显示了应该是什么样子。所以我的问题是如何为uitabbar制作外部阴影?我有一个UITabBarController。到目前为止,这是我的UITabBarController的代码:
import UIKit
class TabBarViewController: UITabBarController, UITabBarControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.selectedIndex = 3
self.delegate = self
UITabBar.appearance().tintColor = UIColor(CGColor: "#6eb18c".CGColor)
UITabBar.appearance().backgroundImage = UIImage(named:"tabbarBackground.png")
let selectedBG = UIImage(named:"tabbarBg.png")?.resizableImageWithCapInsets(UIEdgeInsetsMake(0, 0, 0, 0))
UITabBar.appearance().selectionIndicatorImage = selectedBG
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
if(tabBarController.selectedIndex == 0)
{
print("tabbed index 0")
}
}
}