UITableView not responding to reloadData

Discussion in 'iOS Programming' started by grempel, Oct 5, 2009.

  1. grempel macrumors newbie

    Joined:
    Oct 5, 2009
    #1
    I am using a subclass of UIViewController to manage a TableView page. When I get some XML data I want to force the table to repaint. I call reloadData on the TableView, but get not response. If I click on the table it repaints. What am I doing wrong? numberOfRowsInSection etc are not being called by the processing of reloadData.

    Thanks,
    Gerry
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Are you calling reloadData from the main thread? That's the only one allowed to update the UI.
     
  3. grempel thread starter macrumors newbie

    Joined:
    Oct 5, 2009
    #3
    No, I'm not. How do I make the call on the main thread from my thread that has responded to the update?

    Thanks,
    Gerry
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Search the Developer Documentation for "mainthread".
     
  5. grempel thread starter macrumors newbie

    Joined:
    Oct 5, 2009
    #5
    Thanks,

    I found the performSelectorOnMainThread method which does what is needed.
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    Great. That's what I was hoping you'd say!
     

Share This Page