iOS Question Position of the image in TabBarItem

cruzeiro991

Member
Licensed User
Longtime User
I would like to know how I can adjust the TabBarIcon so that it is centralized vertically, I believe that the space below the image can be of the title, in b4i it talks to pass empty string for the title does not appear.

j7ctbYA0PLy1V0-f6s8IRAw8epaGP2PeEvxV-NT9VnKMtprI7OuhUYFZlu5it5Yp6cQQpWAHyJtfuCYbC87WIg6kkg2YZGcjIU_7B94Lw_oEpfLtTj3RYYywr9vngYoBlCpggEqNkkyrY7NpVBW4yg5-rUNXKPsJpO02RgwhleEAaqijqrWP_-lIRAf73yYyYWnFI5pYICn7pb-9uKs2emj4mtKinmBXFG0g94r7QSO6rOdAjTrM3DBOW-9mkLDZVIq0fBNUciiixaCXlgzlNsX5dBWFvBx1X0DOC20zTwAHjgdbyNpmjCda36RnaAvFzFAlNXH7J3iz7hHpnF5Lc7EhTGveSo9Pexl779fjycZmnutB8D2u_4eYZY9RzouZSZ3KCZROMgawcn6LQpETBvPCYtGo6iYksYxJs1jrkQ6JZ9O-r6JGzLKT9zcBgEtMDrBBO7Ngw0rEQ9HzO7Lw4oz5IcYGS2QOppPeGMFKpdrsWCVEFn9-OB78WrqCF38wF6-zfrEVitSkRzYgMju_qYzTW6IOOp1mJjsXWsS8Hun3Zw5elLbv7PfWmisAza-D=w1366-h613


B4X:
Sub Process_Globals
    Public App As Application
    Private Page1 As Page
    Private tbcx As TabBarController
    Dim nav1 As NavigationController
End Sub

Private Sub Application_Start (nav As NavigationController)
    nav1 = nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    nav1.ShowPage(Page1)

    tbcx.Initialize("tbc")
    App.KeyController = tbcx
    
    Dim p As Page = nav1
    Dim tbb As TabBarItem
    tbb.Initialize("", LoadBitmap(File.DirAssets, "home.png"), Null)
    p.TabBarItem = tbb   
    
    tbcx.Pages = Array(nav1)   
    
End Sub
 

cruzeiro991

Member
Licensed User
Longtime User
Resolved! If someone needs it in the future.

B4X:
Sub Process_Globals
    Public App As Application
    Private Page1 As Page
    Private tbcx As TabBarController
    Dim nav1 As NavigationController
End Sub

Private Sub Application_Start (nav As NavigationController)
    nav1 = nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    nav1.ShowPage(Page1)

    tbcx.Initialize("tbc")
    App.KeyController = tbcx
  
    Dim p As Page = nav1
    Dim tbb As TabBarItem
    tbb.Initialize("", LoadBitmap(File.DirAssets, "home.png"), Null)
    p.TabBarItem = tbb
  
    'add here
    AdjustTabBarItem(p)
  
    tbcx.Pages = Array(nav1)
  
End Sub

Sub AdjustTabBarItem(atbi As Page)
    Dim no As NativeObject = Me
    no.RunMethod("AdjustTabBarItem:", Array(atbi))
End Sub

#if OBJC
- (void)AdjustTabBarItem:(UIViewController*)atbi {
  atbi.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
  atbi.title = nil;
}
#end if
 
Last edited:
Upvote 0
Top