简体   繁体   English

禁用自动滚动UITableView

[英]Disabling Auto Scroll UITableView

I want to disable autoscroll to top. 我想禁用自动滚动到顶部。 I tried both 我都尝试过

    tableview.scrollsToTop=NO;
    [tableview setScrollsToTop:NO];

but that doesn't work. 但这不起作用。

Thanks 谢谢

The automatic scrolling code resides in tableViewController, so auto-scrolling can't be disabled. 自动滚动代码位于tableViewController中,因此不能禁用自动滚动。 Instead of subclassing from UITableViewController you can subclass from UIViewController and use a tableView inside it. 可以从UIViewController继承子类,并在其中使用tableView,而不是从UITableViewController继承子类。

If you are willing to use UITableViewController itself, you can override viewWillAppear and don't call [super viewWillAppear]. 如果您愿意使用UITableViewController本身,则可以重写viewWillAppear而不调用[super viewWillAppear]。

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

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