UISegmentedControl in Navigation Bar

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

  1. macrumors newbie

    Jan 6, 2009

    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?


  2. macrumors regular

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

    macrumors newbie

    Oct 18, 2011
    Having same problem

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

    - (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


    Staff Member

    Sep 2, 2004
    The Centennial State
    Did you hook up your tableView's datasource property?

Share This Page