iOS Question CutomListView:Code is not working

jkhazraji

Active Member
Licensed User
Longtime User
I imported this code from the card list (CustomListView) example of B4a (https://www.b4x.com/android/forum/threads/cards-list-with-customlistview.87720/#content) to B4i. I copied the layouts from the designer with the new feature of B4a and paste it in the designer of B4i , placed the pictures in the project, modified the code accordingly and selected the appropiate libraries(iXUI), but as I run the app only blank panels appear:No text or images..What am I missing?
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Pg As Page
    Private clv1 As CustomListView
    Private ImageView1 As ImageView
    Private lblAction1 As Label
    Private lblAction2 As Label
    Private lblContent As Label
    Private lblTitle As Label
    Private xui As XUI
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl=Nav
    Pg.Initialize("pg")
    Pg.RootPanel.LoadLayout("1")
    NavControl.ShowPage(Pg)
    Pg.RootPanel.Color = Colors.White
    Pg.Title = "Cards"
    Dim bitmaps As List = Array("pexels-photo-446811.jpeg", "pexels-photo-571195.jpeg", _
        "pexels-photo-736212.jpeg", "pexels-photo-592798.jpeg")
    For i = 1 To 4
        Dim content As String = $"Lorem ipsum dolor sit amet,
                                consectetur adipiscing elit,
                                sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."$
        clv1.Add(CreateItem(clv1.AsView.Width, $"This is item #${i}"$, bitmaps.Get(i - 1), content),"")
    Next
End Sub

Private Sub CreateItem(Width As Int, Title As String, Image As String, Content As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    Dim height As Int = 280dip
    'If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then height = 310dip
    p.SetLayoutAnimated(0, 0, 0, Width, height)
    p.LoadLayout("card1")
 
    lblTitle.Text = Title
    lblContent.Text = Content
 
    ImageView1.Bitmap=xui.LoadBitmapResize(File.DirAssets, Image, ImageView1.Width, ImageView1.Height, True)
    Return p
End Sub
 
Last edited:

jkhazraji

Active Member
Licensed User
Longtime User
ezgif-1-00a28f4e323a.gif


Thanks for Reply..It has been resolved
 
Upvote 0
Top