UISegmentedControl in Navigation Bar

Discussion in 'iOS Programming' started by nicoko, Jan 6, 2009.

  1. macrumors newbie

    Joined:
    Jan 6, 2009
    #1
    Hi,

    In one of my views I would like to have a segmented control in the navigation bar.

    Clicking on one of the buttons should reload the table with a different parameter.

    What I have so far:
    - navigation bar with the two segmented control buttons;
    - table with a few cells (data comes from a json file).

    How can I reload the view in order to fill the table with a different json file as source?

    Thanks,

    Nico
     
  2. macrumors regular

    Joined:
    Mar 24, 2008
    #2
    you can call reloadData at anytime on a table.
     
  3. wtucker1664, Oct 18, 2011
    Last edited by a moderator: Oct 18, 2011

    macrumors newbie

    Joined:
    Oct 18, 2011
    #3
    Having same problem

    Hi I have called [AMCustomerTableView reloadData] where AMCustomerTableView is the table view object, but doing an NSLog in the

    Code:
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    function shows that this is not being called when the reloadData is being called.

    I have setup a function called changeSegment and put this in the navigation bar control. Set it as an IBAction and linked this in interface builder.

    I have created a function in the table view control .m file which get the data from a server and returns json this NSMutibleArray is then used to add the data to the table.

    The problem is this is not reloading the data when i click on any of the segment buttons.

    Has anyone else had this problem.
     
  4. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Did you hook up your tableView's datasource property?
     

Share This Page