Accelerator and communication AddDelegate <-> tableView

Discussion in 'iOS Programming' started by MACloop, Mar 19, 2010.

  1. MACloop macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #1
    Hello,
    I have tried to implement an Accelerator in an app. The idea is to let the user update the values in a tableView by shaking the iPhone. In my AppDelegate I have an accelator and it seems to work allright. The problem is that I have a startTableViewController working as a menue. The user may click one of the cells to get to different tableViews showing data of different kind. One of these tableViews should be updated when the iPhone was shaken. What I cannot figure out is how to let the tableViewController and the AppDelegate communicate here. When the view is loaded with a current tableView is the data taken from a variable in the appDelegate with this kind of code:
    Code:
    self.theTableList = [(AppDelegate*)[[UIApplication sharedApplication] delegate] someTableList];
    So being in the current tableView and shaking the phone will update the list in the AppDelegate, but how do I tell the current tableview to reload the data?

    Any advices on this?

    MACloop
     
  2. MACloop thread starter macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #2
    I solved it with the NSNotificationCenter - I hope that is a "good" solution?
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Code:
    [currentTableView reloadData];
    This is pretty easy to find in the UITableView Class Reference. In other words, read the documentation.
     

Share This Page