简体   繁体   English

UITableView -setContentOffset在iOS 7中停止工作

[英]UITableView -setContentOffset stopped working in iOS 7

I have been using - 我一直在使用-

[tableView setContentOffset:CGPointZero animated:NO]

in iOS6 to insure that my tableViews where positioned at the top of the view. 在iOS6中确保我的tableViews位于视图顶部。 I have been refactoring for iOS7 and it seems have stopped working. 我一直在为iOS7重构,它似乎已停止工作。 I have had to replace with - 我不得不替换为-

[tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];

which works with in both cases. 在两种情况下都可以使用。

Anyone have any thoughts? 有人有什么想法吗?

What about using scrollToRowAtIndexPath : 如何使用scrollToRowAtIndexPath

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM