Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.7k views
in Technique[技术] by (71.8m points)

ios - swift: Removing an UI elemet from Others in a tab bar controller

im creating a app that utilises an floating button. i added the floating buttun programmatically in a UITabBarController class, everything works fine. i want to remove this Floating button in the more tab only and if theres any way to rename the more button

image

Heres the UITabBarController Code:

override func viewDidLoad() {
    super.viewDidLoad()
    
    //LanguageModel.CurrentLanguage = currentlanguage
    FloatingBtnSetUpLanguage()

}
private func FloatingBtnSetUpLanguage(){
    let actionButton = JJFloatingActionButton()
    actionButton.buttonImage = UIImage(named: "lggsmenu")
    actionButton.buttonColor = .white
    actionButton.addItem(title: "???????", image: UIImage(named: "ar")) { item in
        self.changeView(lang: "ar")
    }
    actionButton.addItem(title: "French", image: UIImage(named: "fr")) { item in
        self.changeView(lang: "fr")
    }
    actionButton.addItem(title: "English", image: UIImage(named: "en")) { item in
        self.changeView(lang: "en")
        
    }

    view.addSubview(actionButton)
    actionButton.translatesAutoresizingMaskIntoConstraints = false
    actionButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16).isActive = true
    actionButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 10).isActive = true
    actionButton.itemAnimationConfiguration = .slideIn(withInterItemSpacing: -100, firstItemSpacing: -75)
    
}



func changeView(lang: String){
    if ModelManager.getInstance().UpdateDefaultLanguage(language: lang){
        print("language changed to: (lang)")
        LanguageModel.CurrentLanguage = lang
        MOLH.setLanguageTo(lang)
        if #available(iOS 13.0, *) {
                        let delegate = UIApplication.shared.delegate as? AppDelegate
                        delegate!.swichRoot()
                } else {
                       MOLH.reset()
                }
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...