当弹出后出现视图时,ios 8 tableview会自动重新加载 [英] ios 8 tableview reloads automatically when view appears after pop

查看:233
本文介绍了当弹出后出现视图时,ios 8 tableview会自动重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表视图,第7行onclick,我推另一个视图。然后当我使用pop回来时,tableview会在ios8中自动重新加载。它不会发生ios 7.

I have a table view, onclick of 7th row, I push another view. Then when I come back using pop, tableview is reloaded automatically in ios8. It does not happen is ios 7.

问题是没有调用0,1,2,3单元格的cellForRow和HeightForRow。因此,表格向上滚动第7行,并且不可见。可以看到9,10,11个单元格。

Problem is cellForRow and HeightForRow for 0,1,2,3 cell is not called. Hence table scrolls the 7th row up, and not visible. 9,10,11 cells are visible.

我希望表格保持不变,因为当我回到该视图时。

I want table to stay as it was when I come back to that view.

我将selectedIndex和滚动表保存到viewWillAppear中的特定索引。

I saved selectedIndex and scrolled table to particular index in viewWillAppear.

[self.table_exhibitorProfile scrollToRowAtIndexPath:self.selectedIndexPath atScrollPosition:UITableViewScrollPositionNone animated:NO];

它显示第7个单元格,但其位置与原来不一样。它排在最前面。

It shows 7th cell, but its position is not same as it was. It goes to top.

推荐答案

除非你告诉它,否则它不应该重新加载。它不会在iOS 8中自动重新加载。

It shouldn't be reloading unless you tell it to. It's not automatically reloading in iOS 8 for me.

我能想出的唯一可能性是

The only possibilities that I can come up with are that


  1. 您在两个视图控制器中使用CoreData,NSFetchedResutsController和相同的managedObjectContext。如果第二个视图控制器中的managedObjectContext发生了某些变化,当你弹回时,fetchedResultsController将重新加载表,或者

  1. you're using CoreData, an NSFetchedResutsController, and the same managedObjectContext in both view controllers. If something changes in the managedObjectContext in the second view controller, when you pop back, the fetchedResultsController will reload the table, or

你正在调用 tableView.reloadData() in viewWillAppear() viewDidAppear()

you're calling tableView.reloadData() in viewWillAppear() or viewDidAppear().

这篇关于当弹出后出现视图时,ios 8 tableview会自动重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆