Reputation: 245
I have an UITableView and all rows navigate to other UIView which include UIScrollView. Sometimes when I navigate it scroll start middle of the view, or bottom of the view. But I want everytime I scroll it, scroll must be on the top of the view. How can i do that?
Upvotes: 3
Views: 1977
Reputation: 1046
make sure you are using [self.scrViewHaberDetay setContentOffset:CGPointMake(0, 0)];
in viewWillAppear or viewDidAppear, not in the viewDidLoad. It will then work.
Upvotes: 4
Reputation: 14
I think when the UIView loaded, you can manually make it scroll to top, so it will always be start on top. [self.scroll scrollRectToVisible:rc animated:YES], rc is CGRect, you can make it rc.origin.x=0, rc.origin.y=0;
Upvotes: 0
Reputation: 8735
Use this methods : [_tableView setContentOffset:CGPointMake(0.f, 0.f) animated:NO];
Upvotes: 0