iOS Question B4i Image issue

luke2012

Well-Known Member
Licensed User
Longtime User
Hi all,
when I test my (B4XPages) app under iOS (iPhone), occasionally (not always) the images (which are loaded into the CLV) appear blurry.

This happens on both the emulator and the real device (so it could happen to users as well).
Within the Android version (B4XPages app) this problem does not occur.
Why does this happen?

Thanks in advance for your help.
Luca.


Schermata 2021-11-23 alle 10.38.44.png
Schermata 2021-11-23 alle 11.14.36.png
 

luke2012

Well-Known Member
Licensed User
Longtime User
My guess is that you are loading the images with LoadBitmapResize and are doing it before the page has resized.

Best option is to load the full image and use B4XImageView.

Hi Erel,
the relevant code is this:

B4X:
Sub Class_Globals
    Private imgSubCat As B4XView
End Sub

Private Sub CreateItem (aNID As Int, aTitle As String, aImg As Bitmap, iv As ItemValue) As B4XView
    Private pnl As B4XView = xui.CreatePanel("")
    pnl.SetLayoutAnimated (0,0,0,100%x, 300dip)
    pnl.LoadLayout("subcat_itemlayout")
    
    imgSubCat.SetBitmap(aImg.Resize(pnl.Width, 300dip, True))
    
    lblSubCatTitle.Text = aTitle
    iv.nid = aNID
    iv.title = aTitle
    iv.img = aImg
    
    Return pnl
End Sub

I'm loading an "ImageView" with LoadLayout("subcat_itemlayout") than I set it with "imgSubCat.SetBitmap".
 
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
Yes, if the size is too small.

"Best option is to load the full image and use B4XImageView."

Thank you Erel! The mod you suggested works fine (no more blurred images).

Schermata 2021-11-25 alle 09.44.21.png


The only little thing that I cannot understand how to handle is how to fit correctly between top and bottom without show the grey and white horizontal "bars" (as you can see within image above).
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
how to fit correctly between top and bottom without show the grey and white horizontal "bars" (as you can see within image above).
use B4XImageView
resize mode = FILL or FILL_HEIGHT
 
Upvote 0
Top