PDA

View Full Version : UISegmentedControl in Navigation Bar




nicoko
Jan 7, 2009, 01:55 AM
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



fenrus110
Jan 7, 2009, 11:25 AM
you can call reloadData at anytime on a table.

wtucker1664
Oct 18, 2011, 11:07 AM
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.

dejo
Oct 18, 2011, 12:02 PM
...function shows that this is not being called when the reloadData is being called.

Did you hook up your tableView's datasource property?