Italian B4i - Uso TabStrip nei moduli pagina

ken87

Active Member
Licensed User
Longtime User
Salve,
Sto cercando di utilizzare il TabStrip all'interno del modulo pagina in questo modo:

B4X:
'Code module

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Private pg As Page
  
    Private TabStrip1 As TabStrip
End Sub

Public Sub Show
    If pg.IsInitialized = False Then
        pg.Initialize("pg")
        pg.RootPanel.LoadLayout("uno")
        pg.HideBackButton = True '<-- don't want to allow the user to return to the login screen
        'titolo.Font = Font.CreateNew2("fondyscriptpersonaluseonly", 30)
    End If
    Dim no As NativeObject = Main.NavControl
    no.RunMethod("pushViewController:animated:", Array (pg, False))
  
    Main.NavControl.ShowPage(pg)
End Sub


Sub TabStrip1_PageSelected (Position As Int)

Nel Layout "uno" contiene una tabStrip .

Il nome del modulo è "chiama"

Allego il main e sotto il progretto

B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: B4i Example
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 7
#End Region

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 MainPage As Page

    Private TabStrip1 As TabStrip
    Private WebView1 As WebView
    Private TabPages As List
    Private Button1 As Button
End Sub

Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
    NavControl = Nav
    MainPage.Initialize("MainPage")
    MainPage.RootPanel.LoadLayout("Main")
    NavControl.ShowPage(MainPage)
    TabPages.Initialize
    Dim cs As CSBuilder
    Dim page1, page2, page3 As Page
  
  
    page1.Initialize("page1")
    page1.RootPanel.LoadLayout("Tab1")
    page1.Title = "Bing"
    WebView1.LoadUrl("https://www.bing.com")
    TabPages.Add(page1)
  
    page2.Initialize("page2")
    page2.RootPanel.LoadLayout("Tab1")
    WebView1.LoadUrl("https://www.google.com")
    cs.Initialize.Font(Font.CreateFontAwesome(18)).Color(0xFF014E1C).VerticalAlign(-1).Append("Google ").Append(Chr(0xF17B)).PopAll
    SetAttributedTitle(page2, cs)
    TabPages.Add(page2)
  
    page3.Initialize("page3")
    page3.RootPanel.LoadLayout("Tab1")
    WebView1.LoadUrl("https://www.duckduckgo.com")
    SetAttributedTitle(page3, cs.Initialize.Color(0xFFF46903).Append("DuckDuckGo").PopAll)
    TabPages.Add(page3)
      
    TabStrip1.SetPages(TabPages)
  
End Sub

Sub TabStrip1_PageSelected (Position As Int)
    Log("Current page: " & Position)
End Sub

Sub SetAttributedTitle(page As Page, cs As CSBuilder)
    Dim lbl As Label
    lbl.Initialize("")
    lbl.AttributedText = cs
    page.TitleView = lbl
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
  
End Sub

Private Sub Application_Background
  
End Sub




Sub Button1_Click
    carica.Show
End Sub

Quando carico il modulo carica mi segnala questo errore:

B4X:
Application_Start
Application_Active
SignalHandler 11
Error occurred on line: 85 (Main)
Signal - 11
Stack Trace: (
    "0   B4i Example          SignalHandler + 119",
    "1   libsystem_platform.dylib            0x00000001070f3b3a _sigtramp + 26",
    "2   UIKit                __block_descriptor_tmp.8 + 2646344",
    "3   UIKit                -[UICollectionView layoutAttributesForItemAtIndexPath:] + 162",
    "4   B4i Example          -[XLButtonBarView moveFromIndex:toIndex:withProgressPercentage:pagerScroll:] + 123",
    "5   B4i Example          -[XLButtonBarPagerTabStripViewController pagerTabStripViewController:updateIndicatorFromIndex:toIndex:withProgressPercentage:indexWasChanged:] + 119",
    "6   B4i Example          -[B4IPagerTabStrip pagerTabStripViewController:updateIndicatorFromIndex:toIndex:withProgressPercentage:indexWasChanged:] + 107",
    "7   B4i Example          -[XLPagerTabStripViewController updateContent] + 2100",
    "8   B4i Example          -[XLPagerTabStripViewController updateIfNeeded] + 203",
    "9   B4i Example          -[XLPagerTabStripViewController viewDidLayoutSubviews] + 70"
)

Come utilizzo la libreria Tabstrip nei moduli pagina?
Grazie mille
 

Attachments

  • tabstrip_moduli.zip
    114.8 KB · Views: 157
Top