iOS Question TabBarItem doesn't shown

schimanski

Well-Known Member
Licensed User
Longtime 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...
 

schimanski

Well-Known Member
Licensed User
Longtime User
Ok. it works, but why are they to big?

upload_2014-11-20_10-0-5.png
 
Upvote 0

klaus

Expert
Licensed User
Longtime 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 [email protected] 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 ?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The original file is 60 x 60 pixels.
I changed the name to [email protected] 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 :)!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
http://www.b4x.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 [email protected] with the size of 200x200.

You should still load image.png however on a high resolution device [email protected] 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.
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime 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...
 
Upvote 0

klaus

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

Attachments

  • btnch0.png
    btnch0.png
    479 bytes · Views: 280
  • btnch1.png
    btnch1.png
    416 bytes · Views: 283
  • btnfr0.png
    btnfr0.png
    505 bytes · Views: 281
  • btnfr1.png
    btnfr1.png
    446 bytes · Views: 294
Upvote 0
Top