Niloufar
Niloufar

Reputation: 532

prevent uitableView reloading

I am using a uitableView in my application and I want to prevent reloading it in different cases: 1. when I present another modal view on it. 2. row selection happens.

I am not calling [tableview reloadData] in viewWillAppear or viewDidAppear. Is there anyway to prevent this reloading?

Upvotes: 4

Views: 3148

Answers (3)

Niloufar
Niloufar

Reputation: 532

Thanks for your replies. There is no reload calling that causes this issue. I was using auto layout and the constraints set on tableview causes it to reload and change position when other view appears. Solution: When you do a selection os presentation use this command to prevent it from setting position for constraints:

tableView.translatesAutoresizingMaskIntoConstraints = YES;

Upvotes: 0

ErickES7
ErickES7

Reputation: 528

Here is a way you can "track" where function calls come from:

example

  1. Add a breakpoint on the function header of the table view's datasource
  2. Then run your application with the debugger open and when the breakpoint points to your function header, click to the right of the Thread 1 and you will see how this breakpoint was called/reached

I hope this helps you and hope it was something called by you, the programmer because as you can see in my example, there was only one step that was done by me. How i can tell was the blue person icon next to 6 -[ViewController viewDidLoad]

Upvotes: 3

bigCat
bigCat

Reputation: 11

  • (void)reloadData; // reloads everything from scratch. redisplays visible rows. because we only keep info about visible rows, this is cheap. will adjust offset if table shrinks
    maybe can do it in change DataSource

Upvotes: 1

Related Questions