uiscrollviewdelegate

Detecting UIScrollView page change

删除回忆录丶 提交于 2019-11-27 00:19:22
问题 Is there a way to detect or get a notification when user changes the page in a paging-enabled UIScrollView? 回答1: Implement the delegate of UIScrollView. This method is what you are looking for. - (void)scrollViewDidScroll:(UIScrollView *)scrollView 回答2: Use this to detect which page is currently being shown and perform some action on page change: - (void)scrollViewDidScroll:(UIScrollView *)scrollView { static NSInteger previousPage = 0; CGFloat pageWidth = scrollView.frame.size.width; float

iPhone - knowing if a UIScrollView reached the top or bottom

橙三吉。 提交于 2019-11-26 21:36:40
Is there a way to know if a UIScrollView has reached the top or bottom inside - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate ? thanks. Luke Implement the UIScrollViewDelegate in your class, and then add this: -(void)scrollViewDidScroll: (UIScrollView*)scrollView { float scrollViewHeight = scrollView.frame.size.height; float scrollContentSizeHeight = scrollView.contentSize.height; float scrollOffset = scrollView.contentOffset.y; if (scrollOffset == 0) { // then we are at the top } else if (scrollOffset + scrollViewHeight == scrollContentSizeHeight) {

iPhone - knowing if a UIScrollView reached the top or bottom

拥有回忆 提交于 2019-11-26 06:18:53
问题 Is there a way to know if a UIScrollView has reached the top or bottom inside - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate ? thanks. 回答1: Implement the UIScrollViewDelegate in your class, and then add this: -(void)scrollViewDidScroll: (UIScrollView*)scrollView { float scrollViewHeight = scrollView.frame.size.height; float scrollContentSizeHeight = scrollView.contentSize.height; float scrollOffset = scrollView.contentOffset.y; if (scrollOffset ==