ios UITableView reloadData don't increase content height

Posted by Zoltan Varadi on Stack Overflow See other posts from Stack Overflow or by Zoltan Varadi
Published on 2012-12-12T09:22:35Z Indexed on 2012/12/12 17:04 UTC
Read the original article Hit count: 218

Filed under:
|
|

I'm facing a strange error in my iOS app and haven't been able to figure out the reason why.

In my UITableView i can add new cells, so i refresh the array that is the datasource and call reloadData.

Everything works without error. The numberOfRowsInSection is called again, and it's value is one more than it's previous value was. The new cell even gets inserted at the bottom of the tableview, but i cant scroll down to it. I only know that it's there because the tableview bounces and i can see it.

I'm guessing the tableview's content height is not getting increased for some reason, but i have no idea why.

I'm using iOS 6 btw.

Any help is very much appreciated! Thanks,

Zoli

EDIT, answers for Srikanth's questions:

  1. How is data getting added.

There's an NSArray containing objects of a specific type. The array.count is the number of the number of cells. This NSArray gets its values from a database query.

  1. When you say, you are refreshing the array, what do you mean.

By refreshing the array i mean i execute a new query in the database and put the results of this query into an NSArray. this will be the tableview's datasource array. Like this:

dataSourceArray = [dbManager executeQuery];
[tableView reloadData];
  1. Are you adding the data within the same view controller

Yes.

  1. Can you show some code as to what you are doing

See above.

  1. Is the table view at the root of the view controllers view or is it within another view

The tableview is the main view's first child.

  1. Can you try adding data to the array at the beginning, so that you can view the cell being added at the top.

I don't understand what you mean.

© Stack Overflow or respective owner

Related posts about ios

Related posts about uitableview