Closed Ssiswent closed 2 years ago
Sure,
Set UITabbarController to SSCustomTabBarViewController
Set UITabBar to SSCustomTabBar
After performing the above steps you should be able to customise your TabBar
as per your need and use it in your application screen. For more information, you can check the Readme here.
Thanks for your reply. But I just don't know how to use this by pure code🤔
Oh I see your concern now. In my personal opinion it would be better to use with the storyboard itself as it makes things very simpler for the developer. One way I think you can try in swift is mentioned below :
You can create a class which extends SSCustomTabBarViewController
and create an instance of that class inside willConnectTo
of SceneDelegate
while having it as your root view controller. Below is the example code for the same.
You can find example for a class which can extend SSCustomTabBarViewController
and define its ViewControllers here
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Use your class which extends SSCustomTabBarViewController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = YourTabBarViewController()
self.window = window
window.makeKeyAndVisible()
}
}
By this you are ready with our SSCustomTabBarViewController
but I am still not sure how are we gonna provide the custom class to the TabBar
. I did some research on how can we provide such custom class to the TabBar
of some tabbar view controller, but can't get the desired result. So at the end to not make things complex we would recommend to go with the storyboard method as it will not consume much time to just provide classes to our UI elements.
Thanks for reaching us out with your query, will sure look into this once again and will let you if it is possible and if it is worth to use or not.
Really appriciate for your answer, I will consider your opinion carefully, thank you !
The closing issue as the query is solved and the solution was provided.
Can I ask how to use this by swift code ? (Not SwiftUI) Thanks a lot.