Slow TableView with Custom Cells

Discussion in 'iOS Programming' started by donaghy, Nov 5, 2010.

  1. donaghy macrumors member

    Joined:
    Aug 6, 2009
    #1
    Hi all,

    I've created a data entry form using a table view with custom cells. My custom cells are simple cells that contain a label and a textfield or textview. Though i find my table is very slow and "sticky" when scrolling. Is this typical or is there a better working solution for something like this?

    Thanks.
     
  2. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #2
    Code will help. Are you using DequeueReusableCell? What do you mean by custom cells, this could mean many things.
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    Some reasons are

    images in the cells, especially loaded from a remote source,
    loading data from a database, slowly
    loading the cells from nibs,
    other complicated drawing in the cells,
    use of UITextViews in your cells
    variable height rows
    creating a new cell every time
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Don't forget non-opaque subviews! :)
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    Right, I think using clearColor as the background color is supposed to slow things down too.
     
  6. donaghy thread starter macrumors member

    Joined:
    Aug 6, 2009
    #6
    Ok i am loading cells from nibs and using textfields and textviews. I'll try creating the cells programmatically and see if that has any improvement.
     
  7. bredell macrumors regular

    Joined:
    Mar 30, 2008
    Location:
    Uppsala, Sweden
    #7
    The most important thing is to reuse your table cells. If you have complex cells with lots of info it's probably a good idea to create a custom UIView subclass and do all the drawing yourself.

    The WWDC videos have a session on how to improve your table view performance.
     
  8. mmcc macrumors regular

    Joined:
    Nov 8, 2010
    Location:
    Tennessee
    #8
    Does anyone have a pointer to a good reference (or WWDC video) of how to use InterfaceBuilder with UITableView?

    It seems I can do very little to create/format cells in a UITableView via IB. I was hoping for more visual control in this area as iOS matures. There is a UITableCell visual item in IB, but I can't find much info on how to use it. It seems all the Apple examples create all sections/cells in code rather than visually in IB. I am so sick of that default list that is displayed in IB (California, etc.)! :eek:

    Thanks
     

Share This Page