Saturday, November 21, 2026
HomeiOS Developmentios - When offered VC was open instantly after launching of TabBar...

ios – When offered VC was open instantly after launching of TabBar after which dismissed, TabBar will probably be dismissed too

[ad_1]

After I open VC programmatically from my customized TabBarCotroller after which dismiss this VC my tab bar additionally will probably be dismissed, BUT this downside exists if I am going to open this display screen instantly after launching the tab bar if I’ll look forward to one or perhaps 2 seconds conduct after dismissing offered VC will regular and Tab Bar will exist. I attempted to make use of data from this query however nothing was modified Black display screen after presenting modal view controller in present context from UITabBarController

Construction of screens subsequent:
All screens created by Storyboard
In my case exist a display screen, then by segue, I open a tab bar with a customized class, to this tab bar I join 5 screens by storyboard segues. For tab quantity 5 I take advantage of a particular animation impact, conduct subsequent:
When the consumer press on tab quantity 5 this display screen will probably be opened by a transition animation from the precise sight of the display screen to left, like in android, AND this VC will probably be offered above of TabBar.
I obtain this impact by subsequent steps:
I prolong VC for functionality open programmatically
Code that I has add for the potential open VC from Storyboard programmatically:

static func makeMoreVCFromCode(objc: MorePageHomeState) -> MoreVC {
        let vc = UIStoryboard(identify: "Important", bundle: nil).instantiateViewController(withIdentifier: "Extra") as! MoreVC
        vc.initObjc = objc
        return vc
    }

then inside TabBarController, I test when the consumer clicks on tab quantity 5 by delegates of UITabBarContoller and block this motion, after which I am going to open for consumer this display screen with one other animation from TabBar programmatically, when the consumer shut offered VC he will probably be moved again

   func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
        if (viewController is MoreVC) {

            guard transferObject != nil else { return true }
            initMorePage()
            return false
        } else {
            return true
        }
    }

Initialization of offered VC programmatically:

 func initMorePage() {
        
        vcMore = MoreVC.makeMoreVCFromCode(objc: transferObject)
        guard vcMore != nil else { return }
        vcMore!.delegateInteraction = self
        vcMore!.modalPresentationStyle = .customized
        vcMore!.transitioningDelegate = self
        current(vcMore!, animated: true)
    }

All work effectively provided that I’ll do that motion after 1-2 seconds after presenting TabBar if I current this VC instantly after launching of TabBar and dismiss this VC, the tab bar additionally will probably be dismissed. I am unable to perceive this conduct )

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments