iOS Question TabBarItem doesn't shown

schimanski

Well-Known Member
Licensed User
Where do I have to set the TabBarItem?
B4X:
Private Sub Application_Start (Nav As NavigationController)
   
    TabController.Initialize("TabController")
    page1.Initialize("page1")
    page1.RootPanel.LoadLayout("Layout1")
   
    Dim Bm As Bitmap
    Bm=LoadBitmap(File.DirAssets, "test.png")
    page1.TabBarItem.Initialize("Test", Bm, Bm)

    page2.Initialize("page2")
    page2.RootPanel.LoadLayout("Layout2")   

    TabController.Pages = Array(page1, page2)
    App.KeyController = TabController
I have tried also different solutions (60x60, 75x75), but no result...
 

klaus

Expert
Licensed User
@schimanski
What size are the png images in the example in post #3, and on what device ?


@Erel
I tested with 60 x 60 pixel images and they look OK on my iPhone 6.
upload_2014-11-20_13-4-38.png

Changing one of the file names to xxx@2x.png its size becomes half on my iPhone 6 !?
upload_2014-11-20_13-1-0.png


How and where is this handled, isn't iOS supposed to handle this automatically ?
 

klaus

Expert
Licensed User
The original file is 60 x 60 pixels.
I changed the name to xxx@2x.png like your example in post #4, and was downsized.
Now I renamed it to xxx@2x according to your advice in post #8 and now it works as we expect it to work :)!
 

klaus

Expert
Licensed User
Now I am a bit confused.
How do we need to handle this ?
What files and with what names do we need to cover the different densities and how are they treated by B4i or iOS ?
 

Erel

Administrator
Staff member
Licensed User
http://www.basic4ppc.com/b4i/help/drawing.html#bitmap_initialize

The iPhone 6 screen non-normalized scale is 2.
The iPad non-normalized scale is 1.

The logical scale on all devices is 1. This is different than Android and this is why the 'dip' unit is not required in B4i as in B4A.
Lets say we have an image named image.png with the size of 100x100.
This means that when you load this image on iPhone 6, the image will not be super sharp as it is actually mapped to 200x200 real pixels.
So you can add an image named image@2x.png with the size of 200x200.

You should still load image.png however on a high resolution device image@2x.png will be loaded instead and its size will be 100x100 (because we are working with scaled pixels).
A message will be printed in the logs saying that the @2x image was loaded.
 

schimanski

Well-Known Member
Licensed User
Sorry, Klaus, I have seen your post to late. The icons in post #3 are 60x60 on my iphone 6 plus. Now I use the icons with 50x50 in @2x.png and it looks very great. Don't know how it is on other devices:

upload_2014-11-20_19-5-43.png


Most of the icons-packs i have downloaded are only in 50x50, so it is easier to work with...
 

klaus

Expert
Licensed User
To better understand what happens, could you post some of your images.
Attached mine 60 x 60 pixels.
 

Attachments

Top