HomeiOS DevelopmentHow can I add a customized UIView to a floating UITabBarItem?

How can I add a customized UIView to a floating UITabBarItem? [closed]


I wish to add a customized UIView which might show GIFs and Pictures (AnimatedImageView UIView from KingFisher library) on high of the floating UITabBarItem.

iOS 26 launched a behaviour the place on scrolling, the Liquid Glass UITabBar minimises or collapses and the floating UITabBarItem reduces in dimension as properly. I’m able to add the customized UIView on the floating UITabBarItem when the UITabBar is in its common state however it disappears when the UITabBar minimises. And the customized view is once more again when the UITabBar returns to its common state.

How I entry the UIView property of floating UITabBarItem:

extension UIBarItem {
    var view: UIView? {
        return self.worth(forKey: "view") as? UIView
    }
}

I added a background color to the floating UIBarItem:

self.tabBar.gadgets?[4].view?.backgroundColor = .systemRed

Works as anticipated however disappears when the UITabBar minimises:

How can I add a customized UIView to a floating UITabBarItem? [closed]

There’s a name for trait change when the UITabBarAccessory minimises and I’m making an attempt to vary the background color to yellow, however it by no means seems. You possibly can see that yellow color seems when the UITabBar once more modifications to its common state. I can confirm through the View Debugger that the inner UIView _UITabButton modifications its reminiscence handle, however through code I’m unable to entry the modified UIView even through the personal sub views of UITabBar.

The fifth UITabBarItem, how I can add a customized view on high of it? Apple apps have solely used the fifth UITabBarItem for Search:

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments