I would like to hide both bars on scroll down on my iPhone. When I scroll up, they should appear again.. How can I handle this?
- (void)scrollViewWillBeginScroll :(UIScrollView *)scrollView {
if (scrollView.contentOffset.y < lastOffset.y) {
[toolBar setHidden:YES];
[[[self navigationController] navigationBar] setHidden:YES];
} else{
// unhide
}
}
- (void)scrollViewDidScroll :(UIScrollView *)scrollView {
/// blah blah
lastOffset = scrollView.contentOffset;
}
Note : lastOffset
is an CGPoint
and it goes in your header file: @Interface
.