0

My app has 3 tabs (Kids, Points and Requests) with same result list. I'm using a custom cell to show kids information with same data in 3 tabs.

For example:

Kids Tab:

  • Kid name 1
  • Kid name 2
  • Kid name 3

Points tab:

  • Kid name 1
  • Kid name 2
  • Kid name 3

Requests tab:

  • Kid name 1
  • Kid name 2
  • Kid name 3

When I go to Requests and select a kid I push another view with total requests per selected kid. Now the VERY weird thing, when I back to Points or Kids tab and reload (i'm using pull to refresh, what is not the problem) only the FIRST row appear!

I'm using NSXML to parse the XML and adding to a NSMutableArray called itemList after this I populate the tableview.

What I already tried:

  1. tried to replace NSXML with TBXML parser without success the sameproblem occurs.

  2. tried to remove custom cells and use the default cell without success.

  3. tried to change the cell identifiers without success.

  4. tried to change all variables names trying to avoid variable replacement.

  5. NSLog in all vars and objs in app trying to show everything without success.

  6. tried to remove pull to refresh and same problem occurs.

All kind of help its appreciated :)

Thanks! Cleber Santos

  • Do all three table views access the same array object? How and where is the array updated? Show the numberOfRowsInSection method(s) to start with. –  Dec 28 '10 at 17:50
  • Not the same array, every class KidTableViewController, RequestsTableViewController has our array with the data.. – Cleber Santos Dec 28 '10 at 18:24

2 Answers2

1

The first thing you need to know is if this is a data problem or if this is a tableviewdelegate problem. I would start by swapping a static NSArray in place of your data source then re-running your app in the simulator. If it works as expected, then that means that the static data "worked" and the problem is your data source.

If the static NSArray data doesn't work, then that means your problem is with your tableView's delegate or (more likely) dataSource methods. If it turns out this is the case, then try to hunt it down and supply a code sample in a future post if you need help.

NOTE: Before you swap out your data source for the NSArray would be a good time to branch your source in Git/Subversion/whatever so that if it doesn't work with the static data you can pull back your changes. And DON'T TELL ME YOU'RE NOT USING SCM!!!!!

Neal L
  • 4,329
  • 8
  • 34
  • 39
  • confirmed! the problem is data.. just need to found were is the root problem. tks! ;) – Cleber Santos Dec 28 '10 at 19:24
  • Neal, the problem continues.. I guess the problem with data is some type of cache from NSXML because when I refresh the tableview the response from XML has only this FIRST row. Any ideas? – Cleber Santos Dec 29 '10 at 12:15
  • @Binho, I would suggest handling the caching of the XML yourself. Close out this thread since we've solved this problem, then open another one with a code sample showing how you're parsing the XML and storing it in your view controller. – Neal L Dec 29 '10 at 20:24
0

you need to make sure your data source is correct. The UITableView is just that, a view. You need to check that you actually have the data stored properly regardless of your view. My guess is that you clobbered your data when switching views.

brown.2179
  • 1,750
  • 1
  • 12
  • 15