iOS Question [Solved] Tabstrip not working after "reloadPagerTabStripView"

Livio F

Member
Licensed User
Longtime User
Hello everybody. After using the example suggested by Erel. Tab navigation is not functional.
ex: from the first tab to the third.
would you know what it could be?

 

Attachments

  • TabStripRefresh.zip
    112.8 KB · Views: 166

Livio F

Member
Licensed User
Longtime User
Hello Erel.
When I'm on the first tab and tap on the third, the selected tab is in the second position.
 

Attachments

  • tabstrip.jpg
    tabstrip.jpg
    242.4 KB · Views: 139
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I see. The problem is that this event is raised for the intermediate pages as well.
This workaround seems to work:
B4X:
Sub TabStrip1_PageSelected (Position As Int)
    Log("Current page: " & Position)
    For i = 0 To TabPages.Size - 1
        Dim p As Page = TabPages.Get(i)
        Dim lbl As Label = p.TitleView
     
        Dim clr As Int
        If i = Position Then clr = Colors.Red Else clr = Colors.Black
        Dim cs As CSBuilder
        SetAttributedTitle(p, cs.Initialize.Color(clr).Append(lbl.AttributedText.ToString).PopAll)
    Next
       PageSelectedEventIndex = PageSelectedEventIndex + 1 'this is a global variable
    Dim MyIndex As Int = PageSelectedEventIndex
    Dim no As NativeObject = TabStrip1
    Sleep(300)
    If MyIndex = PageSelectedEventIndex Then
        no.RunMethod("reloadPagerTabStripView", Null)
    End If
End Sub

Test it in release mode.
 
Upvote 0

Livio F

Member
Licensed User
Longtime User
I see. The problem is that this event is raised for the intermediate pages as well.
This workaround seems to work:
B4X:
Sub TabStrip1_PageSelected (Position As Int)
    Log("Current page: " & Position)
    For i = 0 To TabPages.Size - 1
        Dim p As Page = TabPages.Get(i)
        Dim lbl As Label = p.TitleView
    
        Dim clr As Int
        If i = Position Then clr = Colors.Red Else clr = Colors.Black
        Dim cs As CSBuilder
        SetAttributedTitle(p, cs.Initialize.Color(clr).Append(lbl.AttributedText.ToString).PopAll)
    Next
       PageSelectedEventIndex = PageSelectedEventIndex + 1 'this is a global variable
    Dim MyIndex As Int = PageSelectedEventIndex
    Dim no As NativeObject = TabStrip1
    Sleep(300)
    If MyIndex = PageSelectedEventIndex Then
        no.RunMethod("reloadPagerTabStripView", Null)
    End If
End Sub

Test it in release mode.
Thank you Erel.
Once I complete the account creation process, I will also test in release mode.
 
Upvote 0
Top