In my table view I have to scroll to the top. But I cannot guarantee that the first object is going to be section 0, row 0. May be that my table view will start from section number 5.
So I get an exception, when I call:
```[mainTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
```
Is there another way to scroll to the top of table view?
Yes, you can scroll to the top of the table view without knowing the exact index path of the first row. One way to do this is by scrolling the table view content to the top offset.

Here's the code:
```swift
[mainTableView setContentOffset:CGPointMake(0, -mainTableView.contentInset.top) animated:NO];
```
This will scroll the table view content to the top,
You're right that if the first object isn't in the first section, then attempting to scroll to section 0, row 0 will result in an exception. However, scrolling to the top of the table view isn't necessarily limited to that specific index path. Instead, you can scroll to the top of the content, regardless of where the first object is located, by invoking the `scrollToTop` method of `UITableView`: