func scrollViewDidScroll(scrollView: UIScrollView) {
let currentY = scrollView.contentOffset.y
let currentBottomY = scrollView.frame.size.height + currentY
if currentY > lastY {
//"scrolling down"
tableView.bounces = true
} else {
//"scrolling up"
// Check that we are not in bottom bounce
if currentBottomY < scrollView.contentSize.height + scrollView.contentInset.bottom {
tableView.bounces = false
}
}
lastY = scrollView.contentOffset.y
}
、オブジェクティブC
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
if (scrollView.contentOffset.y<=0) {
scrollView.contentOffset = CGPointZero;
}
}の
func scrollViewDidScroll(scrollView: UIScrollView) {
if scrollView == self.bootcampStartedTableView {
if scrollView.contentOffset.y <= 0 {
scrollView.contentOffset = CGPoint.zero
}
}
}
を使用