Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func setupNavigationBar(showBack:Bool, showMenu:Bool,isLogin:Bool)
- {
- self.navigationController?.navigationBar.isTranslucent = true
- var leftItemTitle = UIBarButtonItem()
- var backgroundItem = UIBarButtonItem()
- let sizeLength = UIScreen.main.bounds.size.height * 2
- let defaultNavigationBarFrame = CGRect(x: 0, y: 0, width: sizeLength, height: 70)
- let mediumView = UIView()
- let frame = self.navigationController?.navigationBar.frame.size
- mediumView.frame = CGRect(x: 0, y: 0, width: frame!.width, height: frame!.height)
- mediumView.backgroundColor = UIColor.red
- let titleLabel = UILabel()
- titleLabel.text = self.menuText
- titleLabel.font = UIFont.systemFont(ofSize: 20)
- titleLabel.textColor = UIColor.white
- titleLabel.sizeToFit()
- leftItemTitle = UIBarButtonItem(customView: titleLabel)
- if(!showBack && !showMenu && !isLogin){
- self.navigationController?.navigationBar.tintColor = UIColor.clear
- self.navigationItem.leftBarButtonItems?.removeAll()
- self.navigationItem.setHidesBackButton(true, animated:false);
- self.navigationController?.navigationBar.barTintColor = Utils.Color.LigthViewBackGround
- }
- else if(showBack){
- let backMenuButtonItem = UIBarButtonItem(image: UIImage.init(named: "backButton"), style: UIBarButtonItemStyle.done, target: self, action: #selector(backPressed))
- backMenuButtonItem.tintColor = UIColor.white
- backMenuButtonItem.width = CGFloat(30)
- self.navigationItem.leftBarButtonItems = [backMenuButtonItem,leftItemTitle,]
- self.navigationController?.navigationBar.barTintColor = Utils.Color.backgroundBlue
- }
- else if(showMenu){
- let sideMenuButtonItem = UIBarButtonItem(image: UIImage.init(named: "sideMenu"), style: UIBarButtonItemStyle.done, target: self, action: #selector(sideMenuPressed))
- sideMenuButtonItem.tintColor = UIColor.white
- sideMenuButtonItem.width = CGFloat(30)
- let vistaAzul = UIView(frame: CGRect (x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: 30 ))
- vistaAzul.backgroundColor = Utils.Color.BlueLabelText
- }
- else if (isLogin){
- self.navigationController?.navigationBar.barTintColor = Utils.Color.backgroundLogin
- }
- if let hidden = navigationController?.navigationBar.isHidden
- {
- if(hidden)
- {
- self.navigationController?.navigationBar.barStyle = .default
- }
- else
- {
- self.navigationController?.navigationBar.barStyle = .black
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement