iOS Question Custom Cell - TableView help!!

Discussion in 'iOS Questions' started by MarcelloCSI, May 21, 2015.

  1. MarcelloCSI

    MarcelloCSI Active Member Licensed User

    Goodmorning Everyone.

    I need to implement in my app a Tableview with custom cell.
    I've read the discussion "TableView with custom items" starded by Erel but i could not understand many things...

    I need to a customCell with a Label and a Textfield, i created a panel with them through the Layouts Designer. They are placed in a Design called "CustomCell".

    Every time i debug the code i'm obtaining only one row without the custom layout.
    I need to add custom cell dinamically, dependings on TCP listener results.

    Here's my code :
    Code:
    Public Sub LoadPage(Caller As Page, impiantoSelezionato As Int, selezione As Int)

        chiamante = Caller
        impianto = impiantoSelezionato
        selez = selezione
      
        
    If Not(myPage.IsInitialized) Then
            myPage.Initialize(
    "")
            myPage.RootPanel.LoadLayout(
    "SetupItem")
        
    Else
            myPage.RootPanel.LoadLayout(
    "SetupItem")
        
    End If
      
        Main.ActivePage = myPage
        Main.NavControl.ShowPage(myPage)
       
    [INDENT]
    'theme color[/INDENT]
        Main.ColoreTema = 2

        table.Initialize(
    "Table"False)
        myPage.RootPanel.AddView(table,
    0,0,100%x100%y)
        table.RowHeight = PnlCell.Height
      
        LoadData
      
    End Sub

    Private Sub LoadData
      
        proto.Initialize(Me)
        proto.Xpanel.WifiOn = 
    False
        proto.ForceDdns = 
    False
        proto.start
      
        
    If selez = 1 Then
          
    'request a type of data
        Else If selez = 2 Then
          
    'request another type of data
        End If
      
    End Sub


    Private Sub createCell(ID As Int, add As StringAs Panel
        
    Dim p As Panel
        p.Initialize(
    "")
        p.Width = PnlCell.Width
        p.Height = PnlCell.Height
        p.LoadLayout(
    "CustomCell")
        
    Return p
    End Sub


    #Region "Letture da centrale"
    'Response from TCP listener

    Sub XpResponse_NomiGruppi(arg As LinkedList, CmdXp As XpCmd)
      
        
    Dim i As Int

    [INDENT]
    'Arg.size is the number of custom cell that i've to create
    'Arg.size depends on my server response.
    'CmdXp isn't implemented yet
    [/INDENT]
        
    For i=0 To arg.Size -1
            
    Dim tc As TableCell = table.AddSingleLine("")
            tc.ShowSelection = 
    False
            tc.CustomView = createCell(i, arg.Get(i))
        
    Next
      
    End Sub

    #End Region

    arg.size is always > 10

    I need also to modify the Cells's textfields and labels values

    Thnaks in advance for your answare
     
  2. imbault

    imbault Well-Known Member Licensed User

  3. MarcelloCSI

    MarcelloCSI Active Member Licensed User

    That Sub is called after data receiving of another module is completed
     
  4. MarcelloCSI

    MarcelloCSI Active Member Licensed User

    Solved thanks... It was the page resize
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice