Swift 전체 사용자 지정 Tabbar

2530 단어
먼저 CusTomTabBar를 만듭니다.swift 파일의 다음 코드는 다음과 같습니다.
//tabbar  

let tabBarViewHeight: CGFloat = 60

//tabbar  

let tabBarBackColor:UIColor = UIColor.black

//   imageView   

var tabImgViews = [UIImageView]()

var imgArr = ["homePage", "mall" ,"personal"]

var imgSelArr = ["homePage_Se", "mall_Se", "personal_Se"]

var barTitleArr = ["  ","  ","  "]

var tabBarView = UIView()

override func viewDidLoad()

{

super.viewDidLoad()

self.view.backgroundColor = UIColor.white

self.tabBar.isHidden = true

//        viewControllers

initControllers()

//   tabbar

customTabBar()

}

func customTabBar() -> Void

{

tabBarView = UIView(frame: CGRect(x: 0, y: SCREEN_HEIGHT - tabBarViewHeight, width: SCREEN_WIDTH, height: tabBarViewHeight))

tabBarView.backgroundColor = tabBarBackColor

self.view.addSubview(tabBarView)

for index in 0.. Void

{

let indexSel = obj.tag - 100

//        

self.selectedIndex = indexSel

for index in 0.. Void

{

let firstTabView = UIStoryboard.init(name:"FirstPage" , bundle: nil).instantiateViewController(withIdentifier: "FirstPageViewController")

let secondTabView = UIStoryboard.init(name:"SecondPage" , bundle: nil).instantiateViewController(withIdentifier: "SecondPageViewController")

let thirdTabView = UIStoryboard.init(name:"ThirdPage" , bundle: nil).instantiateViewController(withIdentifier: "ThirdPageViewController")

var viewArr = [firstTabView, secondTabView, thirdTabView]

var viewCtlArr = [AnyObject]()

for index in 0..

좋은 웹페이지 즐겨찾기