iOS Question iUI8 Table View - Changing the back color

RichardN

Well-Known Member
Licensed User
Longtime User
I have a module that has a long (750 items) list in the iUI8 TableView comprising short place names using only the two text lines. The module begins....

B4X:
Public Sub Show(Query As String)
    
    If PageBrowse.IsInitialized = False Then
        
        PageBrowse.Initialize("PageBrowse")
        PageBrowse.Title = "Browse"
        TableView1.Initialize("TableView1",False)
        PageBrowse.RootPanel.AddView(TableView1,0,0,100%x,100%y)

        TableView1.Color = Colors.RGB(255,224,179)           'has no effect ???
        
    End If

    Main.NavControl.ShowPage(PageBrowse)
    TableView1.Clear
            
    Airfields = Main.SQL.ExecQuery(Query)
                    
    If Airfields.NextRow = False Then                                'No results returned - Just add one line
        
        TableView1.AddSingleLine("No matching results")
        
    Else                                                            'Something was returned
                                                                      'make sure to include the first record
                                                                    
        TableView1.AddTwoLines(Airfields.GetString("Name"),Airfields.GetString("County"))
        
        Do While Airfields.NextRow                                    'then loop to get the rest
                                
            TableView1.AddTwoLines(Airfields.GetString("Name"),Airfields.GetString("County"))
            
        Loop
    
    End If

    TableView1.ReloadAll
    
End Sub

Doubtless the answer to this is really simple but any attempt to change the TableView1.color fails. The background remains white where ever I put the command.

What am I doing wrong?
 

RichardN

Well-Known Member
Licensed User
Longtime User
Actually I started with xCLV with two labels for the two lines of text....very simple and I hoped a workable solution. Unfortunately with 750 cells the delay in loading was unacceptable - and yes it was in release mode - with a fast iPad Pro...... So I opted to return to a simple text view to minimise the memory overhead. Sadly it appears there is a bug in the iUI8 TableView that returns the view to white as soon as you populate it. So I am forced to return to an xCLV solution and go to the trouble of programming custom cells with lazy-loading.

This can be very frustrating.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
adly it appears there is a bug in the iUI8 TableView that returns the view to white as soon as you populate it.
This is not a bug. It is how the native TableView works.

Unfortunately with 750 cells the delay in loading was unacceptable
1. You can show as many items as you like with xCLV. It is really simple with PreoptimizedCLV.
2. No user will ever want to scroll 750 items. Try it.

So I am forced to return to an xCLV solution and go to the trouble of programming custom cells with lazy-loading.
Programming custom cells = creating a layout file with the designer = 5 minutes of work.
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
No user will ever want to scroll 750 items. Try it.
I entirely agree. Unfortunately, against my advice that's what the client wants so who am I to argue? Fortunately the target device will be an iPad Pro and the fast-scroll handle makes navigating a long list fairly easy. It's just the loading time for the view to appear that is the stumbling block.
Programming custom cells = creating a layout file with the designer = 5 minutes of work.
Not even that long.... Thankfully I had only commented out the previous xCLV code so it was easy to return to the previous version.

What I HAD missed is the PreoptimisedCLV .b4xLib that you have only just recently published. I implemented that and the loading time is now better.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Actually I started with xCLV with two labels for the two lines of text....very simple and I hoped a workable solution. Unfortunately with 750 cells the delay in loading was unacceptable

Why didn't you just use xCLV with lazy loading, you can also have a live active search text box that filters as you type, which I personally include in all my bespoke solutions for clients. But not using lazy loading with long lists is a huge mistake and you really should be using it with xCLV.

Do a forum search for 'long list'.

And also take a look at this...
 
Upvote 0
Top