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 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 ?
 
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 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.
 
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: 276
  • btnch1.png
    btnch1.png
    416 bytes · Views: 278
  • btnfr0.png
    btnfr0.png
    505 bytes · Views: 277
  • btnfr1.png
    btnfr1.png
    446 bytes · Views: 291
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
o.k.
 

Attachments

  • infoicon@2x.png
    infoicon@2x.png
    1.3 KB · Views: 308
  • pfeilpng@2x.png
    pfeilpng@2x.png
    873 bytes · Views: 282
  • karteicon@2x.png
    karteicon@2x.png
    708 bytes · Views: 292
Upvote 0
Top