How to reset the scroll position of a UITableView?

I would like to completely reset the scroll position of a UITableView, so that every time I open it, it is displaying the top-most items. In other words, I would like to scroll the table view to the top every time it is opened.

I tried using the following piece of code, but it looks like I misunderstood the documentation:

- (void)viewWillAppear:(BOOL)animated {
    [tableView scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionTop animated:NO];

Is this the wrong approach here?


August got the UITableView-specific method. Another way to do it is:

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

This method is defined in UIScrollView, the parent class to UITableView. The above example tells it to scroll to the 1x1 box at 0,0 - the top left corner, in other words.

Need Your Help

JMS: publisher publishes to queue, subscriber would like to read like it was a topic

jms weblogic

I have a JMS publisher, which I cannot change (external system). This publisher publishes messages into some predefined JMS queue. I would like to design a multi-node subscriber system in which all

Deleting Registry entries using reg delete

batch-file registry dos

I am trying to delete registry values using reg delete in a batch command. The problem I am having is that I can't delete the value. Here is what I am trying:

ios: Accessing a navigation controller from app delegate

ios uinavigationcontroller push-notification pushviewcontroller uiapplicationdelegate

I have an app that receives push notifications. In didReceiveRemoteNotifications, I would like to make the app show a particular view controller in the app's navigation controller (which happens to...