Reputation:
I would to to scroll to top of the uitableview when the tab bar that currently selected is tab . I have a navigation bar up there example like instagram or twitter you can see that when tap the selected tab bar again the table view scroll to top of the view .How can i do that ?
Upvotes: 0
Views: 1185
Reputation: 176
in override fun viewDidAppear()
of controller simply write this code
if (yourNumberofRowParameterInTable > 0)
{
let indexPath = NSIndexPath(forRow: 0, inSection: 0)
self.tableview.scrollToRowAtIndexPath(indexPath,
atScrollPosition: UITableViewScrollPosition.Top, animated:true)
}
for this code table row should be greater or equal to 1
Please find link of project with your problem solution
Upvotes: 1